From 3cd95a8f6c3d86f8ee7cf24423f7646626d082da Mon Sep 17 00:00:00 2001 From: Nick Galbreath Date: Mon, 12 Apr 2010 21:53:58 -0400 Subject: [PATCH 1/2] add support for span,strong,small,noscript tags (mostly boring but prevents seeing HTMLUnknownElement --- build.xml | 2 ++ src/html/__global__.js | 1 + src/html/document.js | 12 ++++++++++-- test/specs/html/spec.js | 3 ++- 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/build.xml b/build.xml index da33ba90..ab54c775 100644 --- a/build.xml +++ b/build.xml @@ -382,6 +382,7 @@ + @@ -429,6 +430,7 @@ + diff --git a/src/html/__global__.js b/src/html/__global__.js index f152921c..eddc33b4 100644 --- a/src/html/__global__.js +++ b/src/html/__global__.js @@ -47,6 +47,7 @@ var HTMLDocument, HTMLPreElement, HTMLScriptElement, HTMLSelectElement, + HTMLSpanElement, HTMLStyleElement, HTMLTableElement, HTMLTableSectionElement, diff --git a/src/html/document.js b/src/html/document.js index ac820d4d..7bd87c2d 100644 --- a/src/html/document.js +++ b/src/html/document.js @@ -98,6 +98,8 @@ __extend__(HTMLDocument.prototype, { node = new HTMLMapElement(this);break; case "META": node = new HTMLMetaElement(this);break; + case "NOSCRIPT": + node = new HTMLElement(this);break; case "OBJECT": node = new HTMLObjectElement(this);break; case "OPTGROUP": @@ -116,6 +118,12 @@ __extend__(HTMLDocument.prototype, { node = new HTMLScriptElement(this);break; case "SELECT": node = new HTMLSelectElement(this);break; + case "SMALL": + node = new HTMLElement(this);break; + case "SPAN": + node = new HTMLSpanElement(this);break; + case "STRONG": + node = new HTMLElement(this);break; case "STYLE": node = new HTMLStyleElement(this);break; case "TABLE": @@ -421,7 +429,7 @@ Aspect.around({ node = invocation.proceed(), doc = node.ownerDocument; - //console.log('element appended: %s %s', node+'', node.namespaceURI); + //console.log('element appended: %s %s %s', node+'', node.nodeName, node.namespaceURI); if((node.nodeType !== Node.ELEMENT_NODE)){ //for now we are only handling element insertions. probably //we will need to handle text node changes to script tags and @@ -525,7 +533,7 @@ Aspect.around({ }//switch on ns break; default: - console.log('element appended: %s %s', node+'', node.namespaceURI); + // console.log('element appended: %s %s', node+'', node.namespaceURI); }//switch on doc.parsing return node; diff --git a/test/specs/html/spec.js b/test/specs/html/spec.js index dcebf7ca..fed7daf6 100644 --- a/test/specs/html/spec.js +++ b/test/specs/html/spec.js @@ -2,7 +2,7 @@ QUnit.module('html'); test('HTML Interfaces Available', function(){ - expect(52); + expect(53); ok(HTMLDocument, 'HTMLDocument defined'); ok(HTMLElement, 'HTMLElement defined'); ok(HTMLCollection, 'HTMLCollection defined'); @@ -42,6 +42,7 @@ test('HTML Interfaces Available', function(){ ok(HTMLParamElement, 'HTMLParamElement defined'); ok(HTMLScriptElement, 'HTMLScriptElement defined'); ok(HTMLSelectElement, 'HTMLSelectElement defined'); + ok(HTMLSpanElement, 'HTMLSpanElement defined'); ok(HTMLStyleElement, 'HTMLStyleElement defined'); ok(HTMLTableElement, 'HTMLTableElement defined'); ok(HTMLTableSectionElement, 'HTMLTableSectionElement defined'); From cfaf98bf78e723d2532b3e6d951d676ca8eefb0f Mon Sep 17 00:00:00 2001 From: Nick Galbreath Date: Mon, 12 Apr 2010 21:54:59 -0400 Subject: [PATCH 2/2] forgot to add span.js --- src/html/span.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/html/span.js diff --git a/src/html/span.js b/src/html/span.js new file mode 100644 index 00000000..5818ae93 --- /dev/null +++ b/src/html/span.js @@ -0,0 +1,15 @@ +/** + * HTML 5: 4.6.22 The span element + * http://dev.w3.org/html5/spec/Overview.html#the-span-element + * + */ +HTMLSpanElement = function(ownerDocument) { + HTMLElement.apply(this, arguments); +}; +HTMLSpanElement.prototype = new HTMLElement(); +__extend__(HTMLSpanElement.prototype, { + toString: function(){ + return '[object HTMLSpanElement]'; + } +}); +