openstax / css-manipulate

Do more with CSS!
https://jsfiddle.net/philschatz/hjk2z4af/
5 stars 0 forks source link

`move-to()` ignores namespaces #10

Open aiwenar opened 6 years ago

aiwenar commented 6 years ago

Consider following

HTML

<!doctype html>
<html>
    <a></a>
    <b>This is B</b>
    <c>This is C</c>
    <b xmlns="urn:test">This is a different B</b>
    <d xmlns="urn:test">This is D</d>
</html>

CSS

@namespace test "urn:test";

a {
    content:
        parent-context(move-here('b'))
        parent-context(move-here('|c'))
        parent-context(move-here('test|d'));
}

Output (both for master and xml-files) is currently (cleaned)

<html>
<body>
    <a>
        <b>This is B</b>
        <b xmlns="urn:test">This is a different B</b>
    </a>
    <c>This is C</c>
    <d xmlns="urn:test">This is D</d>
</body>
</html>

or, in other words,

  1. move-to treats tag selector as *|tag;
  2. |tag never matches, even though it's equivalent to simply tag;
  3. namespace|tag never matches
philschatz commented 6 years ago

With changes in #8, if you rename <html> to be <nothtml> (or something else) then everything except <c> moves into <a>.

I am not sure why <c> does not move yet, but it's probably a bug in jquery.xmlns.js. If that is a problem, please leave this Issue open and I can take a look at it in another Pull Request.