rrweb-cssom
Advanced tools
Comparing version 0.7.1 to 0.8.0
@@ -150,9 +150,9 @@ var CSSOM = {}; | ||
CSSOM.CSSRule = function CSSRule() { | ||
this.parentRule = null; | ||
this.parentStyleSheet = null; | ||
this.parentRule = null; | ||
this.parentStyleSheet = null; | ||
}; | ||
CSSOM.CSSRule.UNKNOWN_RULE = 0; // obsolete | ||
CSSOM.CSSRule.UNKNOWN_RULE = 0; // obsolete | ||
CSSOM.CSSRule.STYLE_RULE = 1; | ||
CSSOM.CSSRule.CHARSET_RULE = 2; // obsolete | ||
CSSOM.CSSRule.CHARSET_RULE = 2; // obsolete | ||
CSSOM.CSSRule.IMPORT_RULE = 3; | ||
@@ -173,12 +173,12 @@ CSSOM.CSSRule.MEDIA_RULE = 4; | ||
CSSOM.CSSRule.CONTAINER_RULE = 17; | ||
CSSOM.CSSRule.LAYER_BLOCK_RULE = 18; | ||
CSSOM.CSSRule.STARTING_STYLE_RULE = 1002; | ||
CSSOM.CSSRule.prototype = { | ||
constructor: CSSOM.CSSRule | ||
//FIXME | ||
constructor: CSSOM.CSSRule, | ||
//FIXME | ||
}; | ||
exports.CSSRule = CSSOM.CSSRule; | ||
///CommonJS | ||
/** | ||
@@ -1400,2 +1400,41 @@ * @constructor | ||
/** | ||
* @constructor | ||
* @see https://drafts.csswg.org/css-cascade-5/#csslayerblockrule | ||
*/ | ||
CSSOM.CSSLayerBlockRule = function CSSLayerBlockRule() { | ||
CSSOM.CSSGroupingRule.call(this); | ||
this.layerName = ""; | ||
this.cssRules = []; | ||
}; | ||
CSSOM.CSSLayerBlockRule.prototype = new CSSOM.CSSGroupingRule(); | ||
CSSOM.CSSLayerBlockRule.prototype.constructor = CSSOM.CSSLayerBlockRule; | ||
CSSOM.CSSLayerBlockRule.prototype.type = 18; | ||
Object.defineProperties(CSSOM.CSSLayerBlockRule.prototype, { | ||
layerNameText: { | ||
get: function () { | ||
return this.layerName; | ||
}, | ||
set: function (value) { | ||
this.layerName = value; | ||
}, | ||
configurable: true, | ||
enumerable: true, | ||
}, | ||
cssText: { | ||
get: function () { | ||
var cssTexts = []; | ||
for (var i = 0, length = this.cssRules.length; i < length; i++) { | ||
cssTexts.push(this.cssRules[i].cssText); | ||
} | ||
return "@layer " + this.layerNameText + " {" + cssTexts.join("") + "}"; | ||
}, | ||
configurable: true, | ||
enumerable: true, | ||
}, | ||
}); | ||
/** | ||
* @param {string} token | ||
@@ -1434,3 +1473,4 @@ */ | ||
"conditionBlock": true, | ||
'documentRule-begin': true | ||
'documentRule-begin': true, | ||
"layerBlock": true | ||
}; | ||
@@ -1450,3 +1490,3 @@ | ||
var name, priority="", styleRule, mediaRule, containerRule, supportsRule, importRule, fontFaceRule, keyframesRule, documentRule, hostRule, startingStyleRule; | ||
var name, priority="", styleRule, mediaRule, containerRule, supportsRule, importRule, fontFaceRule, keyframesRule, documentRule, hostRule, startingStyleRule, layerBlockRule; | ||
@@ -1564,3 +1604,10 @@ var atKeyframesRegExp = /@(-(?:\w+-)+)?keyframes/g; | ||
break; | ||
} else if (token.indexOf("@supports", i) === i) { | ||
} else if (token.indexOf("@layer", i) === i) { | ||
state = "layerBlock" | ||
layerBlockRule = new CSSOM.CSSLayerBlockRule(); | ||
layerBlockRule.__starts = i; | ||
i += "layer".length; | ||
buffer = ""; | ||
break; | ||
} else if (token.indexOf("@supports", i) === i) { | ||
state = "conditionBlock"; | ||
@@ -1654,2 +1701,13 @@ supportsRule = new CSSOM.CSSSupportsRule(); | ||
state = "before-selector"; | ||
} else if (state === "layerBlock") { | ||
layerBlockRule.layerNameText = buffer.trim(); | ||
if (parentRule) { | ||
ancestorRules.push(parentRule); | ||
} | ||
currentScope = parentRule = layerBlockRule; | ||
layerBlockRule.parentStyleSheet = styleSheet; | ||
buffer = ""; | ||
state = "before-selector"; | ||
} else if (state === "hostRule-begin") { | ||
@@ -1831,2 +1889,3 @@ if (parentRule) { | ||
|| parentRule.constructor.name === "CSSContainerRule" | ||
|| parentRule.constructor.name === "CSSLayerBlockRule" | ||
|| parentRule.constructor.name === "CSSStartingStyleRule" | ||
@@ -1931,2 +1990,6 @@ ) { | ||
if (rule.hasOwnProperty('layerName')) { | ||
ruleClone.layerName = rule.layerName; | ||
} | ||
if (rule.hasOwnProperty('cssRules')) { | ||
@@ -1933,0 +1996,0 @@ ruleClone.cssRules = clone(rule).cssRules; |
@@ -13,3 +13,4 @@ //.CommonJS | ||
CSSKeyframeRule: require('./CSSKeyframeRule').CSSKeyframeRule, | ||
CSSKeyframesRule: require('./CSSKeyframesRule').CSSKeyframesRule | ||
CSSKeyframesRule: require('./CSSKeyframesRule').CSSKeyframesRule, | ||
CSSLayerBlockRule: require('./CSSLayerBlockRule').CSSLayerBlockRule | ||
}; | ||
@@ -65,2 +66,6 @@ ///CommonJS | ||
if (rule.hasOwnProperty('layerName')) { | ||
ruleClone.layerName = rule.layerName; | ||
} | ||
if (rule.hasOwnProperty('cssRules')) { | ||
@@ -67,0 +72,0 @@ ruleClone.cssRules = clone(rule).cssRules; |
@@ -5,3 +5,2 @@ //.CommonJS | ||
/** | ||
@@ -13,9 +12,9 @@ * @constructor | ||
CSSOM.CSSRule = function CSSRule() { | ||
this.parentRule = null; | ||
this.parentStyleSheet = null; | ||
this.parentRule = null; | ||
this.parentStyleSheet = null; | ||
}; | ||
CSSOM.CSSRule.UNKNOWN_RULE = 0; // obsolete | ||
CSSOM.CSSRule.UNKNOWN_RULE = 0; // obsolete | ||
CSSOM.CSSRule.STYLE_RULE = 1; | ||
CSSOM.CSSRule.CHARSET_RULE = 2; // obsolete | ||
CSSOM.CSSRule.CHARSET_RULE = 2; // obsolete | ||
CSSOM.CSSRule.IMPORT_RULE = 3; | ||
@@ -36,13 +35,11 @@ CSSOM.CSSRule.MEDIA_RULE = 4; | ||
CSSOM.CSSRule.CONTAINER_RULE = 17; | ||
CSSOM.CSSRule.LAYER_BLOCK_RULE = 18; | ||
CSSOM.CSSRule.STARTING_STYLE_RULE = 1002; | ||
CSSOM.CSSRule.prototype = { | ||
constructor: CSSOM.CSSRule | ||
//FIXME | ||
constructor: CSSOM.CSSRule, | ||
//FIXME | ||
}; | ||
//.CommonJS | ||
exports.CSSRule = CSSOM.CSSRule; | ||
///CommonJS |
@@ -24,3 +24,4 @@ 'use strict'; | ||
exports.CSSValueExpression = require('./CSSValueExpression').CSSValueExpression; | ||
exports.CSSLayerBlockRule = require('./CSSLayerBlockRule').CSSLayerBlockRule; | ||
exports.parse = require('./parse').parse; | ||
exports.clone = require('./clone').clone; |
@@ -40,3 +40,4 @@ //.CommonJS | ||
"conditionBlock": true, | ||
'documentRule-begin': true | ||
'documentRule-begin': true, | ||
"layerBlock": true | ||
}; | ||
@@ -56,3 +57,3 @@ | ||
var name, priority="", styleRule, mediaRule, containerRule, supportsRule, importRule, fontFaceRule, keyframesRule, documentRule, hostRule, startingStyleRule; | ||
var name, priority="", styleRule, mediaRule, containerRule, supportsRule, importRule, fontFaceRule, keyframesRule, documentRule, hostRule, startingStyleRule, layerBlockRule; | ||
@@ -170,3 +171,10 @@ var atKeyframesRegExp = /@(-(?:\w+-)+)?keyframes/g; | ||
break; | ||
} else if (token.indexOf("@supports", i) === i) { | ||
} else if (token.indexOf("@layer", i) === i) { | ||
state = "layerBlock" | ||
layerBlockRule = new CSSOM.CSSLayerBlockRule(); | ||
layerBlockRule.__starts = i; | ||
i += "layer".length; | ||
buffer = ""; | ||
break; | ||
} else if (token.indexOf("@supports", i) === i) { | ||
state = "conditionBlock"; | ||
@@ -260,2 +268,13 @@ supportsRule = new CSSOM.CSSSupportsRule(); | ||
state = "before-selector"; | ||
} else if (state === "layerBlock") { | ||
layerBlockRule.layerNameText = buffer.trim(); | ||
if (parentRule) { | ||
ancestorRules.push(parentRule); | ||
} | ||
currentScope = parentRule = layerBlockRule; | ||
layerBlockRule.parentStyleSheet = styleSheet; | ||
buffer = ""; | ||
state = "before-selector"; | ||
} else if (state === "hostRule-begin") { | ||
@@ -437,2 +456,3 @@ if (parentRule) { | ||
|| parentRule.constructor.name === "CSSContainerRule" | ||
|| parentRule.constructor.name === "CSSLayerBlockRule" | ||
|| parentRule.constructor.name === "CSSStartingStyleRule" | ||
@@ -509,2 +529,3 @@ ) { | ||
CSSOM.CSSDocumentRule = require('./CSSDocumentRule').CSSDocumentRule; | ||
CSSOM.CSSLayerBlockRule = require("./CSSLayerBlockRule").CSSLayerBlockRule; | ||
///CommonJS |
@@ -10,3 +10,3 @@ { | ||
], | ||
"version": "0.7.1", | ||
"version": "0.8.0", | ||
"author": "Nikita Vasilyev <me@elv1s.ru>", | ||
@@ -13,0 +13,0 @@ "repository": "rrweb-io/CSSOM", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
105478
30
3678