On 1/10/16, 7:35 AM, "Harbs" <harbs.li...@gmail.com> wrote:
>Here’s an item in the spec which I’m having trouble understanding: > >When the [[AddInScopeNamespace]] method of an XML object x is called with >a namespace N, the following steps are taken: >1. If x.[[Class]] ∈ {"text", "comment", "processing-instruction", >“attribute”}, return >2. If N.prefix != undefined > a. If N.prefix == "" and x.[[Name]].uri == "", return > b. Let match be null > c. For each ns in x.[[InScopeNamespaces]] > i. If N.prefix == ns.prefix, let match = ns > d. If match is not null and match.uri is not equal to N.uri > i. Remove match from x.[[InScopeNamespaces]] > e. Let x.[[InScopeNamespaces]] = x.[[InScopeNamespaces]] ∪ { N } > f. If x.[[Name]].[[Prefix]] == N.prefix > i. Let x.[[Name]].prefix = undefined > g. For each attr in x.[[Attributes]] > i. If attr.[[Name]].[[Prefix]] == N.prefix, let attr.[[Name]].prefix >= undefined >3. Return > >I do not understand e through g. It looks like the spec says you are >supposed to remove the prefixes of the XML which has the namespace added >to it if the prefix matches the added namespace. Why would you do that? I don't know for sure. Maybe because they are now in scope, a prefix is no longer needed? -Alex