From fdcbf08572f79b888be87f6879895bbffdc40756 Mon Sep 17 00:00:00 2001 From: Steve Orvell Date: Thu, 14 Nov 2013 18:07:27 -0800 Subject: [PATCH] =?UTF-8?q?simplify=20=E2=80=98unresolved=E2=80=99.=20Now?= =?UTF-8?q?=20to=20shim=20:unresolved,=20we=20simply=20remove=20an=20attri?= =?UTF-8?q?bute=20named=20unresolved.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.json | 1 - custom-elements.js | 1 - src/CustomElements.js | 2 ++ test/js/upgrade.js | 13 +++++++++++-- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/build.json b/build.json index 4e20bc5..086cb11 100644 --- a/build.json +++ b/build.json @@ -1,7 +1,6 @@ [ "../MutationObservers/build.json", "src/scope.js", - "src/unresolved.js", "src/MutationObserver.js", "src/Observer.js", "src/CustomElements.js", diff --git a/custom-elements.js b/custom-elements.js index a6aa2a9..60d3d65 100644 --- a/custom-elements.js +++ b/custom-elements.js @@ -10,7 +10,6 @@ var thisFile = 'custom-elements.js'; var scopeName = 'CustomElements'; var modules = [ '../MutationObservers/mutation-observers.js', - 'src/unresolved.js', 'src/Observer.js', 'src/CustomElements.js', 'src/Parser.js', diff --git a/src/CustomElements.js b/src/CustomElements.js index c01781f..49e5235 100644 --- a/src/CustomElements.js +++ b/src/CustomElements.js @@ -208,6 +208,8 @@ if (useNative) { if (definition.is) { element.setAttribute('is', definition.is); } + // remove 'unresolved' attr, which is a standin for :unresolved. + element.removeAttribute('unresolved'); // make 'element' implement definition.prototype implement(element, definition); // flag as upgraded diff --git a/test/js/upgrade.js b/test/js/upgrade.js index fecaa0b..54a49f6 100644 --- a/test/js/upgrade.js +++ b/test/js/upgrade.js @@ -112,7 +112,16 @@ suite('upgradeElements', function() { assert.equal(b.test, 'ybutton'); assert.equal(b.textContent, i); }); - - }); + + // polyfill only tests + if (!CustomElements.useNative) { + test('unresolved attribute removed after upgrade', function() { + work.innerHTML = 'Resolved!'; + registerTestComponent('x-res', 'res'); + var xres = work.firstChild; + assert.equal(xres.value, 'res'); + assert.isFalse(xres.hasAttribute('unresolved'), 'unresolved is removed after upgrade'); + }); + } }); \ No newline at end of file