* 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)
| 1267 | */ |
| 1268 | |
| 1269 | function getValueForAttribute(node, name, expected) { |
| 1270 | { |
| 1271 | if (!isAttributeNameSafe(name)) { |
| 1272 | return; |
| 1273 | } |
| 1274 | |
| 1275 | if (!node.hasAttribute(name)) { |
| 1276 | return expected === undefined ? undefined : null; |
| 1277 | } |
| 1278 | |
| 1279 | var value = node.getAttribute(name); |
| 1280 | |
| 1281 | if (value === '' + expected) { |
| 1282 | return expected; |
| 1283 | } |
| 1284 | |
| 1285 | return value; |
| 1286 | } |
| 1287 | } |
| 1288 | /** |
| 1289 | * Sets the value for a property on a node. |
| 1290 | * |
no test coverage detected