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

Function setProperty

test/unit/test-fixed-layer.js:234–255  ·  view source on GitHub ↗
(prop, value, priority)

Source from the content-addressed store, hash-verified

232 transition: '',
233
234 setProperty(prop, value, priority) {
235 // Override if important
236 if (priority === 'important') {
237 elem.style[prop] = `${value} !${priority}`;
238 } else if (
239 elem.style[prop] ||
240 !elem.computedStyle[prop]?.endsWith('!important')
241 ) {
242 if (
243 prop === 'transition' &&
244 !value &&
245 endsWith(elem.style[prop] || '', '!important')
246 ) {
247 // Emulate a stupid Safari bug.
248 // noop.
249 } else {
250 // If element style is already set, we can override
251 // Or, if computed style is not important priority
252 elem.style[hypenCaseToCamelCase(prop)] = value;
253 }
254 }
255 },
256 },
257 computedStyle: {
258 opacity: '0.9',

Callers

nothing calls this directly

Calls 2

endsWithFunction · 0.90
hypenCaseToCamelCaseFunction · 0.90

Tested by

no test coverage detected