From cb5c1bd5ea908053f3234f2c7edb7d20c484d436 Mon Sep 17 00:00:00 2001 From: Steve Orvell Date: Thu, 29 Aug 2013 17:52:51 -0700 Subject: [PATCH] addresses issue #262 --- src/declaration/styles.js | 15 +++-- test/html/styling/sheet-scope.html | 90 ++++++++++++++++++++++++++++++ test/js/styling.js | 1 + 3 files changed, 102 insertions(+), 4 deletions(-) create mode 100644 test/html/styling/sheet-scope.html diff --git a/src/declaration/styles.js b/src/declaration/styles.js index f094fde450..f6a22024ef 100644 --- a/src/declaration/styles.js +++ b/src/declaration/styles.js @@ -26,6 +26,7 @@ */ installSheets: function() { this.cacheSheets(); + this.cacheStyles(); this.installLocalSheets(); this.installGlobalStyles(); }, @@ -40,6 +41,14 @@ } }); }, + cacheStyles: function() { + this.styles = this.findNodes(STYLE_SELECTOR + '[' + SCOPE_ATTR + ']'); + this.styles.forEach(function(s) { + if (s.parentNode) { + s.parentNode.removeChild(s); + } + }); + }, /** * Takes external stylesheets loaded in an element and moves * their content into a + + + +
1
+
2
+
3
+
4
+ + + + + + + + + + + + + + + diff --git a/test/js/styling.js b/test/js/styling.js index 6655a99520..45de82b1a1 100644 --- a/test/js/styling.js +++ b/test/js/styling.js @@ -5,6 +5,7 @@ */ htmlSuite('styling', function() { htmlTest('html/styling/sheet-order.html'); + htmlTest('html/styling/sheet-scope.html'); htmlTest('html/styling/sheet-main-doc.html'); htmlTest('html/styling/apply-reset-styles.html'); });