GithubHelp home page GithubHelp logo

support for empty-element tags? about delite HOT 6 CLOSED

ibm-js avatar ibm-js commented on July 28, 2024
support for empty-element tags?

from delite.

Comments (6)

wkeese avatar wkeese commented on July 28, 2024

AFAIK it works, although I haven't tried it.

from delite.

seb-pereira avatar seb-pereira commented on July 28, 2024

Although I'm not sure it is related to the parser, it doesn't work when there are multiple instances declared with a self-closing tag or an instance declared with a self-closing tag followed by an instance declared with a closing-tag:

  1. Multiple self-closing tag instances:
<d-self-closing-tag id="instance1"/>
<d-self-closing-tag id="instance2"/>
  1. Self-closing tag followed by closing-tag instance:
<d-self-closing-tag id="instance1"/>
<d-self-closing-tag id="instance2"></d-self-closing-tag>

Assuming that buidRendering creates a div child element, in both case the generated DOM structure is:

<d-self-closing-tag id="instance1">
    <d-self-closing-tag id="instance2">
        <div></div>
    </d-self-closing-tag>
    <div></div>
</d-self-closing-tag>

instead of:

<d-self-closing-tag id="instance1">
  <div></div>
</d-self-closing-tag>
<d-self-closing-tag id="instance2">
  <div></div>
</d-self-closing-tag>

I pushed a simple test case in branch https://github.com/seb-pereira/dui/tree/SelfClosingTag
https://github.com/seb-pereira/dui/blob/SelfClosingTag/SelfClosingTag.js
https://github.com/seb-pereira/dui/blob/SelfClosingTag/tests/test_SelfClosingTag.html

from delite.

wkeese avatar wkeese commented on July 28, 2024

OK, and which browser is it failing on for you?

from delite.

seb-pereira avatar seb-pereira commented on July 28, 2024

Tested on desktop browsers FF 26 and Chrome 31.

from delite.

wkeese avatar wkeese commented on July 28, 2024

OK... I'll look but probably it's just a browser limitation that we can't do anything about. You can try checking what the DOM looks like before the parser is called, and see if it's accurate or corrupt.

from delite.

wkeese avatar wkeese commented on July 28, 2024

I tested this and it's a problem with the browser(s). The browsers interpret markup like:

<d-self-closing-tag id="instance1"/>
<d-self-closing-tag id="instance2"></d-self-closing-tag>

as a DOM structure of:

<d-self-closing-tag id="instance1">
    <d-self-closing-tag id="instance2">
    </d-self-closing-tag>
</d-self-closing-tag>

This happens even when you don't run the parser, even when dui/delite is not even included on the page.

Therefore, AFAICT we just can't support empty elements. Too bad.

from delite.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.