mirror of
https://github.com/Polymer/polymer.git
synced 2025-02-25 18:55:30 -06:00
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:
commit
b448c18035
@ -30,9 +30,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
|
|
||||||
* :host(...) -> scopeName...
|
* :host(...) -> scopeName...
|
||||||
|
|
||||||
* ::content -> ' ' NOTE: requires use of scoping selector and selectors
|
* ::content -> ' '
|
||||||
cannot otherwise be scoped:
|
|
||||||
e.g. :host ::content > .bar -> x-foo > .bar
|
|
||||||
|
|
||||||
* ::shadow, /deep/: processed similar to ::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 stop = false;
|
||||||
var hostContext = false;
|
var hostContext = false;
|
||||||
var self = this;
|
var self = this;
|
||||||
|
selector = selector.replace(CONTENT_START, HOST + ' $1');
|
||||||
selector = selector.replace(SIMPLE_SELECTOR_SEP, function(m, c, s) {
|
selector = selector.replace(SIMPLE_SELECTOR_SEP, function(m, c, s) {
|
||||||
if (!stop) {
|
if (!stop) {
|
||||||
var info = self._transformCompoundSelector(s, c, scope, hostScope);
|
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
|
// NOTE: this supports 1 nested () pair for things like
|
||||||
// :host(:not([selected]), more general support requires
|
// :host(:not([selected]), more general support requires
|
||||||
// parsing which seems like overkill
|
// parsing which seems like overkill
|
||||||
var HOST_PAREN = /(\:host)(?:\(((?:\([^)(]*\)|[^)(]*)+?)\))/g;
|
var HOST_PAREN = /(:host)(?:\(((?:\([^)(]*\)|[^)(]*)+?)\))/g;
|
||||||
var HOST_CONTEXT = ':host-context';
|
var HOST_CONTEXT = ':host-context';
|
||||||
var HOST_CONTEXT_PAREN = /(.*)(?::host-context)(?:\(((?:\([^)(]*\)|[^)(]*)+?)\))(.*)/;
|
var HOST_CONTEXT_PAREN = /(.*)(?::host-context)(?:\(((?:\([^)(]*\)|[^)(]*)+?)\))(.*)/;
|
||||||
var CONTENT = '::content';
|
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 CSS_ATTR_SUFFIX = ']';
|
||||||
var PSEUDO_PREFIX = ':';
|
var PSEUDO_PREFIX = ':';
|
||||||
var CLASS = 'class';
|
var CLASS = 'class';
|
||||||
|
var CONTENT_START = new RegExp('^(' + CONTENT + ')');
|
||||||
|
|
||||||
// exports
|
// exports
|
||||||
return api;
|
return api;
|
||||||
|
@ -200,7 +200,7 @@
|
|||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
:host ::content .add3 {
|
::content .add3 {
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
height: 20px;
|
height: 20px;
|
||||||
background: #333;
|
background: #333;
|
||||||
@ -240,7 +240,7 @@
|
|||||||
padding: 4px;
|
padding: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
:host ::content .add2 {
|
::content .add2 {
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
height: 20px;
|
height: 20px;
|
||||||
background: gray;
|
background: gray;
|
||||||
@ -281,7 +281,7 @@
|
|||||||
padding: 4px;
|
padding: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
:host ::content .add1 {
|
::content .add1 {
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
height: 20px;
|
height: 20px;
|
||||||
background: lightgray;
|
background: lightgray;
|
||||||
|
Loading…
Reference in New Issue
Block a user