| 380 | }; |
| 381 | |
| 382 | const getAttrib = (elm: string | Element | null, name: string, defaultVal: string = ''): string => { |
| 383 | let value: string | undefined; |
| 384 | |
| 385 | const $elm = _get(elm); |
| 386 | |
| 387 | if (Type.isNonNullable($elm) && SugarNode.isElement($elm)) { |
| 388 | const hook = attrHooks[name]; |
| 389 | |
| 390 | if (hook && hook.get) { |
| 391 | value = hook.get($elm.dom, name); |
| 392 | } else { |
| 393 | value = Attribute.get($elm, name); |
| 394 | } |
| 395 | } |
| 396 | |
| 397 | return Type.isNonNullable(value) ? value : defaultVal; |
| 398 | }; |
| 399 | |
| 400 | const getAttribs = (elm: string | Element): NamedNodeMap | Attr[] => { |
| 401 | const node = get(elm); |