(parser)
| 26648 | } |
| 26649 | |
| 26650 | function attrib (parser) { |
| 26651 | if (!parser.strict) { |
| 26652 | parser.attribName = parser.attribName[parser.looseCase]() |
| 26653 | } |
| 26654 | |
| 26655 | if (parser.attribList.indexOf(parser.attribName) !== -1 || |
| 26656 | parser.tag.attributes.hasOwnProperty(parser.attribName)) { |
| 26657 | parser.attribName = parser.attribValue = '' |
| 26658 | return |
| 26659 | } |
| 26660 | |
| 26661 | if (parser.opt.xmlns) { |
| 26662 | var qn = qname(parser.attribName, true) |
| 26663 | var prefix = qn.prefix |
| 26664 | var local = qn.local |
| 26665 | |
| 26666 | if (prefix === 'xmlns') { |
| 26667 | // namespace binding attribute. push the binding into scope |
| 26668 | if (local === 'xml' && parser.attribValue !== XML_NAMESPACE) { |
| 26669 | strictFail(parser, |
| 26670 | 'xml: prefix must be bound to ' + XML_NAMESPACE + '\n' + |
| 26671 | 'Actual: ' + parser.attribValue) |
| 26672 | } else if (local === 'xmlns' && parser.attribValue !== XMLNS_NAMESPACE) { |
| 26673 | strictFail(parser, |
| 26674 | 'xmlns: prefix must be bound to ' + XMLNS_NAMESPACE + '\n' + |
| 26675 | 'Actual: ' + parser.attribValue) |
| 26676 | } else { |
| 26677 | var tag = parser.tag |
| 26678 | var parent = parser.tags[parser.tags.length - 1] || parser |
| 26679 | if (tag.ns === parent.ns) { |
| 26680 | tag.ns = Object.create(parent.ns) |
| 26681 | } |
| 26682 | tag.ns[local] = parser.attribValue |
| 26683 | } |
| 26684 | } |
| 26685 | |
| 26686 | // defer onattribute events until all attributes have been seen |
| 26687 | // so any new bindings can take effect. preserve attribute order |
| 26688 | // so deferred events can be emitted in document order |
| 26689 | parser.attribList.push([parser.attribName, parser.attribValue]) |
| 26690 | } else { |
| 26691 | // in non-xmlns mode, we can emit the event right away |
| 26692 | parser.tag.attributes[parser.attribName] = parser.attribValue |
| 26693 | emitNode(parser, 'onattribute', { |
| 26694 | name: parser.attribName, |
| 26695 | value: parser.attribValue |
| 26696 | }) |
| 26697 | } |
| 26698 | |
| 26699 | parser.attribName = parser.attribValue = '' |
| 26700 | } |
| 26701 | |
| 26702 | function openTag (parser, selfClosing) { |
| 26703 | if (parser.opt.xmlns) { |
no test coverage detected