Skip to content
This repository has been archived by the owner on Mar 13, 2018. It is now read-only.

Commit

Permalink
Change override constucturs to filter out wrappers
Browse files Browse the repository at this point in the history
  • Loading branch information
arv committed Feb 20, 2014
1 parent d492fa4 commit 343e74a
Show file tree
Hide file tree
Showing 2 changed files with 97 additions and 22 deletions.
44 changes: 23 additions & 21 deletions src/wrappers/override-constructors.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,48 +11,53 @@
// for.
var elements = {
'a': 'HTMLAnchorElement',

// Do not create an applet element by default since it shows a warning in
// IE.
// https://github.com/Polymer/polymer/issues/217
// 'applet': 'HTMLAppletElement',

'area': 'HTMLAreaElement',
'br': 'HTMLBRElement',
'audio': 'HTMLAudioElement',
'base': 'HTMLBaseElement',
'body': 'HTMLBodyElement',
'br': 'HTMLBRElement',
'button': 'HTMLButtonElement',
'canvas': 'HTMLCanvasElement',
'caption': 'HTMLTableCaptionElement',
'col': 'HTMLTableColElement',
// 'command': 'HTMLCommandElement', // Not fully implemented in Gecko.
'dl': 'HTMLDListElement',
'datalist': 'HTMLDataListElement',
'content': 'HTMLContentElement',
'data': 'HTMLDataElement',
'datalist': 'HTMLDataListElement',
'del': 'HTMLModElement',
'dir': 'HTMLDirectoryElement',
'div': 'HTMLDivElement',
'dl': 'HTMLDListElement',
'embed': 'HTMLEmbedElement',
'fieldset': 'HTMLFieldSetElement',
'font': 'HTMLFontElement',
'form': 'HTMLFormElement',
'frame': 'HTMLFrameElement',
'frameset': 'HTMLFrameSetElement',
'hr': 'HTMLHRElement',
'head': 'HTMLHeadElement',
'h1': 'HTMLHeadingElement',
'head': 'HTMLHeadElement',
'hr': 'HTMLHRElement',
'html': 'HTMLHtmlElement',
'iframe': 'HTMLIFrameElement',
'img': 'HTMLImageElement',
'input': 'HTMLInputElement',
'li': 'HTMLLIElement',
'keygen': 'HTMLKeygenElement',
'label': 'HTMLLabelElement',
'legend': 'HTMLLegendElement',
'li': 'HTMLLIElement',
'link': 'HTMLLinkElement',
'map': 'HTMLMapElement',
'marquee': 'HTMLMarqueeElement',
'menu': 'HTMLMenuElement',
'menuitem': 'HTMLMenuItemElement',
'meta': 'HTMLMetaElement',
'meter': 'HTMLMeterElement',
'del': 'HTMLModElement',
'ol': 'HTMLOListElement',
'object': 'HTMLObjectElement',
'ol': 'HTMLOListElement',
'optgroup': 'HTMLOptGroupElement',
'option': 'HTMLOptionElement',
'output': 'HTMLOutputElement',
Expand All @@ -63,23 +68,23 @@
'q': 'HTMLQuoteElement',
'script': 'HTMLScriptElement',
'select': 'HTMLSelectElement',
'shadow': 'HTMLShadowElement',
'source': 'HTMLSourceElement',
'span': 'HTMLSpanElement',
'style': 'HTMLStyleElement',
'time': 'HTMLTimeElement',
'caption': 'HTMLTableCaptionElement',
'table': 'HTMLTableElement',
'tbody': 'HTMLTableSectionElement',
// WebKit and Moz are wrong:
// https://bugs.webkit.org/show_bug.cgi?id=111469
// https://bugzilla.mozilla.org/show_bug.cgi?id=848096
// 'td': 'HTMLTableCellElement',
'col': 'HTMLTableColElement',
'table': 'HTMLTableElement',
'tr': 'HTMLTableRowElement',
'thead': 'HTMLTableSectionElement',
'tbody': 'HTMLTableSectionElement',
'template': 'HTMLTemplateElement',
'textarea': 'HTMLTextAreaElement',
'track': 'HTMLTrackElement',
'thead': 'HTMLTableSectionElement',
'time': 'HTMLTimeElement',
'title': 'HTMLTitleElement',
'tr': 'HTMLTableRowElement',
'track': 'HTMLTrackElement',
'ul': 'HTMLUListElement',
'video': 'HTMLVideoElement',
};
Expand All @@ -100,7 +105,4 @@
window[name] = scope.wrappers[name]
});

// Export for testing.
scope.knownElements = elements;

})(window.ShadowDOMPolyfill);
75 changes: 74 additions & 1 deletion test/js/wrappers.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,80 @@ suite('Wrapper creation', function() {

var wrap = ShadowDOMPolyfill.wrap;
var unwrap = ShadowDOMPolyfill.unwrap;
var knownElements = ShadowDOMPolyfill.knownElements;

var knownElements = {
'a': 'HTMLAnchorElement',
// Do not create an applet element by default since it shows a warning in
// IE.
// https://github.com/Polymer/polymer/issues/217
// 'applet': 'HTMLAppletElement',
'area': 'HTMLAreaElement',
'br': 'HTMLBRElement',
'base': 'HTMLBaseElement',
'body': 'HTMLBodyElement',
'button': 'HTMLButtonElement',
// 'command': 'HTMLCommandElement', // Not fully implemented in Gecko.
'dl': 'HTMLDListElement',
'datalist': 'HTMLDataListElement',
'data': 'HTMLDataElement',
'dir': 'HTMLDirectoryElement',
'div': 'HTMLDivElement',
'embed': 'HTMLEmbedElement',
'fieldset': 'HTMLFieldSetElement',
'font': 'HTMLFontElement',
'form': 'HTMLFormElement',
'frame': 'HTMLFrameElement',
'frameset': 'HTMLFrameSetElement',
'hr': 'HTMLHRElement',
'head': 'HTMLHeadElement',
'h1': 'HTMLHeadingElement',
'html': 'HTMLHtmlElement',
'iframe': 'HTMLIFrameElement',
'input': 'HTMLInputElement',
'li': 'HTMLLIElement',
'label': 'HTMLLabelElement',
'legend': 'HTMLLegendElement',
'link': 'HTMLLinkElement',
'map': 'HTMLMapElement',
'marquee': 'HTMLMarqueeElement',
'menu': 'HTMLMenuElement',
'menuitem': 'HTMLMenuItemElement',
'meta': 'HTMLMetaElement',
'meter': 'HTMLMeterElement',
'del': 'HTMLModElement',
'ol': 'HTMLOListElement',
'object': 'HTMLObjectElement',
'optgroup': 'HTMLOptGroupElement',
'option': 'HTMLOptionElement',
'output': 'HTMLOutputElement',
'p': 'HTMLParagraphElement',
'param': 'HTMLParamElement',
'pre': 'HTMLPreElement',
'progress': 'HTMLProgressElement',
'q': 'HTMLQuoteElement',
'script': 'HTMLScriptElement',
'select': 'HTMLSelectElement',
'source': 'HTMLSourceElement',
'span': 'HTMLSpanElement',
'style': 'HTMLStyleElement',
'time': 'HTMLTimeElement',
'caption': 'HTMLTableCaptionElement',
// WebKit and Moz are wrong:
// https://bugs.webkit.org/show_bug.cgi?id=111469
// https://bugzilla.mozilla.org/show_bug.cgi?id=848096
// 'td': 'HTMLTableCellElement',
'col': 'HTMLTableColElement',
'table': 'HTMLTableElement',
'tr': 'HTMLTableRowElement',
'thead': 'HTMLTableSectionElement',
'tbody': 'HTMLTableSectionElement',
'textarea': 'HTMLTextAreaElement',
'track': 'HTMLTrackElement',
'title': 'HTMLTitleElement',
'ul': 'HTMLUListElement',
'video': 'HTMLVideoElement',
};


test('Br element wrapper', function() {
var br = document.createElement('br');
Expand Down

0 comments on commit 343e74a

Please sign in to comment.