MCPcopy
hub / github.com/webpack/webpack / sameAttrs

Function sameAttrs

lib/html/syntax.js:4994–5015  ·  view source on GitHub ↗
(
		/** @type {HtmlElement} */ a,
		/** @type {HtmlElement} */ b
	)

Source from the content-addressed store, hash-verified

4992 afe.push({ element: el });
4993 };
4994 const sameAttrs = (
4995 /** @type {HtmlElement} */ a,
4996 /** @type {HtmlElement} */ b
4997 ) => {
4998 const aa = a.attributes;
4999 const ba = b.attributes;
5000 if (aa.length !== ba.length) return false;
5001 // Names are unique (deduped), counts tiny — a nested scan beats a Map
5002 // here and allocates nothing on this formatting-element hot path.
5003 for (let i = 0; i < ba.length; i++) {
5004 const x = ba[i];
5005 let ok = false;
5006 for (let j = 0; j < aa.length; j++) {
5007 if (aa[j].name === x.name) {
5008 ok = aa[j].value === x.value;
5009 break;
5010 }
5011 }
5012 if (!ok) return false;
5013 }
5014 return true;
5015 };
5016 const insertMarker = () => afe.push({ marker: true });
5017 const clearAfeToMarker = () => {
5018 while (afe.length) {

Callers 1

pushAfeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected