1 2 goog.provide('xrx.markup'); 3 4 goog.require('goog.dom'); 5 6 7 xrx.markup = function() { 8 9 }; 10 11 12 /** @const */ xrx.markup.REF = 'data-xrx-ref'; 13 14 15 xrx.markup.prototype.element = function(id) { 16 var element = goog.dom.getElement(this.id); 17 18 if (!element) throw Error('Element with ID <' + id.toString() + '> does not exist.'); 19 20 return element; 21 }; 22 23 24 25 xrx.markup.prototype.ref = function() { 26 var ref = this.element().getAttribute(xrx.markup.REF); 27 28 if (ref === '') throw Error('A non empty ref attribute is missing. ' + element.toString()); 29 30 return ref; 31 }; 32 33 34 35 xrx.markup.id = function(element) { 36 var id = element.getAttribute('id'); 37 38 if (id === '') throw Error('A non empty id attribute is missing. ' + element.toString()); 39 40 return id; 41 };