MCPcopy
hub / github.com/css/csso / getPropertyFingerprint

Function getPropertyFingerprint

lib/restructure/6-restructBlock.js:74–201  ·  view source on GitHub ↗
(propertyName, declaration, fingerprints)

Source from the content-addressed store, hash-verified

72};
73
74function getPropertyFingerprint(propertyName, declaration, fingerprints) {
75 const realName = resolveProperty(propertyName).basename;
76
77 if (realName === 'background') {
78 return propertyName + ':' + generate(declaration.value);
79 }
80
81 const declarationId = declaration.id;
82 let fingerprint = fingerprints[declarationId];
83
84 if (!fingerprint) {
85 switch (declaration.value.type) {
86 case 'Value':
87 const special = {};
88 let vendorId = '';
89 let iehack = '';
90 let raw = false;
91
92 declaration.value.children.forEach(function walk(node) {
93 switch (node.type) {
94 case 'Value':
95 case 'Brackets':
96 case 'Parentheses':
97 node.children.forEach(walk);
98 break;
99
100 case 'Raw':
101 raw = true;
102 break;
103
104 case 'Identifier': {
105 const { name } = node;
106
107 if (!vendorId) {
108 vendorId = resolveKeyword(name).vendor;
109 }
110
111 if (/\\[09]/.test(name)) {
112 iehack = RegExp.lastMatch;
113 }
114
115 if (SAFE_VALUES.hasOwnProperty(realName)) {
116 if (SAFE_VALUES[realName].indexOf(name) === -1) {
117 special[name] = true;
118 }
119 } else if (DONT_MIX_VALUE.hasOwnProperty(realName)) {
120 if (DONT_MIX_VALUE[realName].test(name)) {
121 special[name] = true;
122 }
123 }
124
125 break;
126 }
127
128 case 'Function': {
129 let { name } = node;
130
131 if (!vendorId) {

Callers 2

needlessFunction · 0.85
processRuleFunction · 0.85

Calls 1

generateFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…