mirror of
https://github.com/Polymer/polymer.git
synced 2025-02-25 18:55:30 -06:00
Using constant rather than plain :host
and ::content
, also create regexp object only once
This commit is contained in:
parent
d9f3dda973
commit
c6c28f5197
@ -159,7 +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)/, ':host $1');
|
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);
|
||||||
@ -255,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';
|
||||||
@ -265,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;
|
||||||
|
Loading…
Reference in New Issue
Block a user