1 /** 2 * @fileoverview Class implements data binding for the 3 * model-view-controller. 4 */ 5 6 goog.provide('xrx.bind'); 7 8 9 goog.require('xrx.model'); 10 goog.require('xrx.xpath'); 11 12 13 14 /** 15 * @constructor 16 */ 17 xrx.bind = function(element) { 18 19 20 21 goog.base(this, element); 22 23 24 25 this.node; 26 }; 27 goog.inherits(xrx.bind, xrx.model); 28 29 30 31 /** 32 * (Re)calculates the XPath expression defined in attribute 33 * data-xrx-ref. 34 * 35 * @override 36 */ 37 xrx.bind.prototype.recalculate = function() { 38 var result = xrx.xpath.evaluate(this.getRefExpression(), new xrx.node.Document(), null, 39 xrx.xpath.XPathResultType.ANY_TYPE); 40 41 this.node = result.iterateNext(); 42 }; 43 44