| 1 | export function findNeighbour(element, tag) { |
| 2 | var tagLower = tag.toLowerCase(); |
| 3 | |
| 4 | var previous = element.previousSibling; |
| 5 | while (!isNull(previous)) { |
| 6 | if (previous.tagName.toLowerCase() === tagLower) { |
| 7 | return previous; |
| 8 | } |
| 9 | |
| 10 | previous = previous.previousSibling; |
| 11 | } |
| 12 | |
| 13 | var next = element.nextSibling; |
| 14 | while (!isNull(next)) { |
| 15 | if (next.tagName.toLowerCase() === tagLower) { |
| 16 | return next; |
| 17 | } |
| 18 | |
| 19 | next = next.nextSibling; |
| 20 | } |
| 21 | |
| 22 | return null; |
| 23 | } |
| 24 | |
| 25 | export function isEmptyString(value) { |
| 26 | return isNull(value) || ((typeof value === 'string') && (value.length === 0)); |