r100985 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r100984‎ | r100985 | r100986 >
Date:15:31, 27 October 2011
Author:tparscal
Status:deferred
Tags:
Comment:
Added getElementAttribute method for reading attributes of document nodes
Modified paths:
  • /trunk/parsers/wikidom/lib/hype/bases/es.DocumentModelNode.js (modified) (history)

Diff [purge]

Index: trunk/parsers/wikidom/lib/hype/bases/es.DocumentModelNode.js
@@ -156,6 +156,19 @@
157157 };
158158
159159 /**
 160+ * Gets an element attribute value.
 161+ *
 162+ * @method
 163+ * @returns {Mixed} Value of attribute, or null if no such attribute exists
 164+ */
 165+es.DocumentModelNode.prototype.getElementAttribute = function( key ) {
 166+ if ( this.element.attributes && key in this.element.attributes ) {
 167+ return this.element.attributes[key];
 168+ }
 169+ return null;
 170+};
 171+
 172+/**
160173 * Gets the content length.
161174 *
162175 * FIXME: This method makes assumptions that a node with a data property is a DocumentModel, which

Status & tagging log