MCPcopy
hub / github.com/facebook/react / isValueDirty

Function isValueDirty

packages/react-dom/src/__tests__/ReactDOMInput-test.js:35–43  ·  view source on GitHub ↗
(node)

Source from the content-addressed store, hash-verified

33 }
34
35 function isValueDirty(node) {
36 // Return the "dirty value flag" as defined in the HTML spec. Cast to text
37 // input to sidestep complicated value sanitization behaviors.
38 const copy = node.cloneNode();
39 copy.type = 'text';
40 // If modifying the attribute now doesn't change the value, the value was already detached.
41 copy.defaultValue += Math.random();
42 return copy.value === node.value;
43 }
44
45 function isCheckedDirty(node) {
46 // Return the "dirty checked flag" as defined in the HTML spec.

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected