@@ 562-584 (lines=23) @@ | ||
559 | * |
|
560 | * @param node Root element to process |
|
561 | */ |
|
562 | function stripCustomNsAttrs(node) { |
|
563 | while (node) { |
|
564 | if (node.nodeType === window.Node.ELEMENT_NODE) { |
|
565 | var attrs = node.attributes; |
|
566 | for (var i = 0, l = attrs.length; i < l; i++) { |
|
567 | var attrNode = attrs[i]; |
|
568 | var attrName = attrNode.name.toLowerCase(); |
|
569 | if (attrName === 'xmlns:ns1' || attrName.lastIndexOf('ns1:', 0) === 0) { |
|
570 | node.removeAttributeNode(attrNode); |
|
571 | i--; |
|
572 | l--; |
|
573 | } |
|
574 | } |
|
575 | } |
|
576 | ||
577 | var nextNode = node.firstChild; |
|
578 | if (nextNode) { |
|
579 | stripCustomNsAttrs(nextNode); |
|
580 | } |
|
581 | ||
582 | node = getNonDescendant('nextSibling', node); |
|
583 | } |
|
584 | } |
|
585 | ||
586 | function getNonDescendant(propName, node) { |
|
587 | // An element is clobbered if its `propName` property points to one of its descendants |
@@ 512-534 (lines=23) @@ | ||
509 | * |
|
510 | * @param node Root element to process |
|
511 | */ |
|
512 | function stripCustomNsAttrs(node) { |
|
513 | while (node) { |
|
514 | if (node.nodeType === window.Node.ELEMENT_NODE) { |
|
515 | var attrs = node.attributes; |
|
516 | for (var i = 0, l = attrs.length; i < l; i++) { |
|
517 | var attrNode = attrs[i]; |
|
518 | var attrName = attrNode.name.toLowerCase(); |
|
519 | if (attrName === 'xmlns:ns1' || attrName.lastIndexOf('ns1:', 0) === 0) { |
|
520 | node.removeAttributeNode(attrNode); |
|
521 | i--; |
|
522 | l--; |
|
523 | } |
|
524 | } |
|
525 | } |
|
526 | ||
527 | var nextNode = node.firstChild; |
|
528 | if (nextNode) { |
|
529 | stripCustomNsAttrs(nextNode); |
|
530 | } |
|
531 | ||
532 | node = getNonDescendant('nextSibling', node); |
|
533 | } |
|
534 | } |
|
535 | ||
536 | function getNonDescendant(propName, node) { |
|
537 | // An element is clobbered if its `propName` property points to one of its descendants |