MCPcopy Create free account
hub / github.com/ampproject/amphtml / propertiesFromRule

Function propertiesFromRule

third_party/webcomponentsjs/ShadowCSS.js:252–274  ·  view source on GitHub ↗
(rule)

Source from the content-addressed store, hash-verified

250}
251
252export function propertiesFromRule(rule) {
253 var cssText = rule.style.cssText;
254 // TODO(sorvell): Safari cssom incorrectly removes quotes from the content
255 // property. (https://bugs.webkit.org/show_bug.cgi?id=118045)
256 // don't replace attr rules
257 if (rule.style.content && !rule.style.content.match(/['"]+|attr/)) {
258 cssText = cssText.replace(/content:[^;]*;/g, 'content: \'' +
259 rule.style.content + '\';');
260 }
261 // TODO(sorvell): we can workaround this issue here, but we need a list
262 // of troublesome properties to fix https://github.com/Polymer/platform/issues/53
263 //
264 // inherit rules can be omitted from cssText
265 // TODO(sorvell): remove when Blink bug is fixed:
266 // https://code.google.com/p/chromium/issues/detail?id=358273
267 var style = rule.style;
268 for (var i in style) {
269 if (style[i] === 'initial') {
270 cssText += i + ': initial; ';
271 }
272 }
273 return cssText;
274}
275
276var selectorRe = /([^{]*)({[\s\S]*?})/gim,
277 cssCommentRe = /\/\*[^*]*\*+([^/*][^*]*\*+)*\//gim,

Callers 1

scopeRulesFunction · 0.85

Calls 1

replaceMethod · 0.45

Tested by

no test coverage detected