* Get the value for a attribute on a node. Only used in DEV for SSR validation. * The third argument is used as a hint of what the expected value is. Some * attributes have multiple equivalent values.
(node, name, expected)
| 4944 | */ |
| 4945 | |
| 4946 | function getValueForAttribute(node, name, expected) { |
| 4947 | { |
| 4948 | if (!isAttributeNameSafe(name)) { |
| 4949 | return; |
| 4950 | } |
| 4951 | |
| 4952 | if (!node.hasAttribute(name)) { |
| 4953 | return expected === undefined ? undefined : null; |
| 4954 | } |
| 4955 | |
| 4956 | var value = node.getAttribute(name); |
| 4957 | |
| 4958 | if (value === '' + expected) { |
| 4959 | return expected; |
| 4960 | } |
| 4961 | |
| 4962 | return value; |
| 4963 | } |
| 4964 | } |
| 4965 | /** |
| 4966 | * Sets the value for a property on a node. |
| 4967 | * |
no test coverage detected