MCPcopy Create free account
hub / github.com/angular/angular / unwrapImgVideoSrcValue

Function unwrapImgVideoSrcValue

packages/core/src/render3/instructions/shared.ts:339–356  ·  view source on GitHub ↗

* This function allows us to workaround a breaking change introduced by #71095 * src attributes/bindings used to be sanitized which was responsible for: * - converting undefined/null to '' * - supporting bypassed values (via bypassSecurityTrustResourceUrl) * * This workaround is intended to be

(
  propName: string,
  element: RElement,
  value: unknown,
  isAttribute = false,
)

Source from the content-addressed store, hash-verified

337 * This workaround is intended to be dropped in v23 when the breaking change window opens.
338 */
339function unwrapImgVideoSrcValue(
340 propName: string,
341 element: RElement,
342 value: unknown,
343 isAttribute = false,
344): any {
345 if (
346 propName === 'src' &&
347 ((element as RElement).tagName === 'IMG' || (element as RElement).tagName === 'VIDEO')
348 ) {
349 if (value == null) {
350 return isAttribute ? value : '';
351 }
352
353 return unwrapSafeValue(value);
354 }
355 return value;
356}
357
358/** If node is an OnPush component, marks its LView dirty. */
359export function markDirtyIfOnPush(lView: LView, viewIndex: number): void {

Callers 2

setDomPropertyFunction · 0.85
elementAttributeInternalFunction · 0.85

Calls 1

unwrapSafeValueFunction · 0.90

Tested by

no test coverage detected