UNPKG

browser-x

Version:

A partial implementation of the W3C DOM API on top of an HTML5 parser and serializer.

39 lines (30 loc) 922 B
'use strict'; var Element = require('./element'); var CSSStyleDeclaration = require('cssstyle').CSSStyleDeclaration; function HTMLElement(document, name, namespaceURI) { Element.call(this, document, name, namespaceURI); } HTMLElement.prototype = Object.create(Element.prototype, { style: { get: function() { if (this._style) { return this._style; } else { var style = this._style = new CSSStyleDeclaration(); var cssText = this.getAttribute('style'); if (cssText) { style.cssText = cssText; } return this._style; } } }, // support nwmatcher lang: { get: function() { return this.getAttribute('lang') || ''; } } }); HTMLElement.prototype.constructor = HTMLElement; module.exports = HTMLElement;