Merge pull request #2419 from nazar-pc/content-selector-fix

Eliminate the need to write `:host ::content` instead of just `::content`
This commit is contained in:
Steve Orvell 2016-02-03 16:02:14 -08:00
commit b448c18035
2 changed files with 7 additions and 7 deletions

View File

@ -30,9 +30,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* :host(...) -> scopeName...
* ::content -> ' ' NOTE: requires use of scoping selector and selectors
cannot otherwise be scoped:
e.g. :host ::content > .bar -> x-foo > .bar
* ::content -> ' '
* ::shadow, /deep/: processed similar to ::content
@ -161,6 +159,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
var stop = false;
var hostContext = false;
var self = this;
selector = selector.replace(CONTENT_START, HOST + ' $1');
selector = selector.replace(SIMPLE_SELECTOR_SEP, function(m, c, s) {
if (!stop) {
var info = self._transformCompoundSelector(s, c, scope, hostScope);
@ -256,7 +255,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
// NOTE: this supports 1 nested () pair for things like
// :host(:not([selected]), more general support requires
// parsing which seems like overkill
var HOST_PAREN = /(\:host)(?:\(((?:\([^)(]*\)|[^)(]*)+?)\))/g;
var HOST_PAREN = /(:host)(?:\(((?:\([^)(]*\)|[^)(]*)+?)\))/g;
var HOST_CONTEXT = ':host-context';
var HOST_CONTEXT_PAREN = /(.*)(?::host-context)(?:\(((?:\([^)(]*\)|[^)(]*)+?)\))(.*)/;
var CONTENT = '::content';
@ -266,6 +265,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
var CSS_ATTR_SUFFIX = ']';
var PSEUDO_PREFIX = ':';
var CLASS = 'class';
var CONTENT_START = new RegExp('^(' + CONTENT + ')');
// exports
return api;

View File

@ -200,7 +200,7 @@
box-sizing: border-box;
}
:host ::content .add3 {
::content .add3 {
box-sizing: border-box;
height: 20px;
background: #333;
@ -240,7 +240,7 @@
padding: 4px;
}
:host ::content .add2 {
::content .add2 {
box-sizing: border-box;
height: 20px;
background: gray;
@ -281,7 +281,7 @@
padding: 4px;
}
:host ::content .add1 {
::content .add1 {
box-sizing: border-box;
height: 20px;
background: lightgray;