diff options
author | John Resig <jeresig@gmail.com> | 2007-07-08 23:52:14 +0000 |
---|---|---|
committer | John Resig <jeresig@gmail.com> | 2007-07-08 23:52:14 +0000 |
commit | b147039acc32884b50b955ebd94eeaa430713786 (patch) | |
tree | 07635e31d3336f6325807a8bb57344f29104e88e /build | |
parent | 69ef5fac9e84623c1260cf4d548c1034ac7e45a8 (diff) | |
download | jquery-b147039acc32884b50b955ebd94eeaa430713786.tar.gz jquery-b147039acc32884b50b955ebd94eeaa430713786.zip |
Added a number of fixes: Tag name case-sensitivity, text escaping, opacity setting. Tweaked the test suite slightly.
Diffstat (limited to 'build')
-rw-r--r-- | build/runtest/env.js | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/build/runtest/env.js b/build/runtest/env.js index e15284293..f3afb1959 100644 --- a/build/runtest/env.js +++ b/build/runtest/env.js @@ -86,13 +86,15 @@ var window = this; DOMDocument.prototype = { createTextNode: function(text){ - return makeNode( this._dom.createTextNode(text) ); + return makeNode( this._dom.createTextNode( + text.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">")) ); }, createElement: function(name){ - return makeNode( this._dom.createElement(name) ); + return makeNode( this._dom.createElement(name.toLowerCase()) ); }, getElementsByTagName: function(name){ - return new DOMNodeList( this._dom.getElementsByTagName(name) ); + return new DOMNodeList( this._dom.getElementsByTagName( + name.toLowerCase()) ); }, getElementById: function(id){ var elems = this._dom.getElementsByTagName("*"); @@ -221,7 +223,10 @@ var window = this; window.DOMElement = function(elem){ this._dom = elem; - this.style = {}; + this.style = { + get opacity(){ return this._opacity; }, + set opacity(val){ this._opacity = val + ""; } + }; // Load CSS info var styles = (this.getAttribute("style") || "").split(/\s*;\s*/); @@ -271,6 +276,10 @@ var window = this; return this.childNodes.valueOf(); }, set innerHTML(html){ + html = html.replace(/<\/?([A-Z]+)/g, function(m){ + return m.toLowerCase(); + }); + var nodes = this.ownerDocument.importNode( new DOMDocument( new java.io.ByteArrayInputStream( (new java.lang.String("<wrap>" + html + "</wrap>")) @@ -299,8 +308,7 @@ var window = this; set textContent(text){ while (this.firstChild) this.removeChild( this.firstChild ); - this.appendChild( document.createTextNode(text) ); - this.innerHTML = document.createTextNode(text).nodeValue; + this.appendChild( this.ownerDocument.createTextNode(text)); }, style: {}, |