From b87c8f4ce0e512e909fccd0ad3c579abf8527889 Mon Sep 17 00:00:00 2001 From: AJ Ortega Date: Fri, 16 Jan 2015 12:42:47 -0800 Subject: [PATCH] Document.matches shouldn't be defined. See https://github.com/webcomponents/webcomponentsjs/issues/12 for context. --- src/ShadowDOM/wrappers/Document.js | 8 +++++++- tests/ShadowDOM/js/Document.js | 5 +++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/ShadowDOM/wrappers/Document.js b/src/ShadowDOM/wrappers/Document.js index 82c4859..6dee221 100644 --- a/src/ShadowDOM/wrappers/Document.js +++ b/src/ShadowDOM/wrappers/Document.js @@ -242,7 +242,13 @@ 'querySelectorAll', 'removeChild', 'replaceChild', - ].concat(matchesNames)); + ]); + + forwardMethodsToWrapper([ + window.HTMLBodyElement, + window.HTMLHeadElement, + window.HTMLHtmlElement, + ], matchesNames); forwardMethodsToWrapper([ window.HTMLDocument || window.Document, // Gecko adds these to HTMLDocument diff --git a/tests/ShadowDOM/js/Document.js b/tests/ShadowDOM/js/Document.js index 0dcbfe4..45f2453 100644 --- a/tests/ShadowDOM/js/Document.js +++ b/tests/ShadowDOM/js/Document.js @@ -53,6 +53,11 @@ htmlSuite('Document', function() { assert.equal(doc.head.parentNode, doc.documentElement); }); + test('document.matches', function() { + var doc = wrap(document); + assert.isTrue(doc.matches === undefined); + }); + test('getElementsByTagName', function() { var elements = document.getElementsByTagName('body'); assert.isTrue(elements instanceof HTMLCollection);