Giter Club home page Giter Club logo

vdom-to-html's People

Contributors

floatdrop avatar gyzerok avatar jesseditson avatar lightman76 avatar ntharim avatar tdumitrescu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

vdom-to-html's Issues

Namespaced properties don't seem to work

The vdom structure:

var test = svg('svg',
    svg('use', {
      'xlink:href': "symbols.svg#symbol1"
    })
);

Renders fine in the browser but vdom-to-html outputs <svg><use></use></svg>

Let me know if I can help!

why handle data-* and aria-* as properties

data-* and aria-* should be handled as attributes rather than have a special case for them as properties.

https://github.com/nthtran/vdom-to-html/blob/fe04172917f596dc4b24a4b0dc20c747c9454144/test/test.js#L58-L64 is currently

  it('should render `data-` and `aria-` properties', function () {
    var node = new VNode('web-component', {
      'data-click': 'clicked!',
      'aria-labelledby': 'label'
    });
    assert.equal(toHTML(node), '<web-component data-click="clicked!" aria-labelledby="label"></web-component>');
  });

these shouldn't need to be handled as a special case in properties because it is inconsistent with what virtual-dom does and so any rendering code which uses these as attributes will not produce the same results in the browser. as attributes these don't need any special handling.

  it('should render `data-` and `aria-` attributes', function () {
    var node = new VNode('web-component', {
      attributes: {
        'data-click': 'clicked!',
        'aria-labelledby': 'label'
      }
    });
    assert.equal(toHTML(node), '<web-component data-click="clicked!" aria-labelledby="label"></web-component>');
  });

is this something you want to continue to support or are you open to dropping them?

dataset property is ignored.

Shouldn't toHTML(h('div', {dataset: {key: 'value'}})) render to <div data-key="value"></div>? Today it is giving <div></div>, although toHTML(h('div', {attributes: {'data-key': 'value'}})) works.

All attribute hooks are not rendered

I'm having some problems with value attribute being rendered as [object Object] instead of its actual value. This is because a soft hook is created and the following code does not render it because of the second condition value.namespace.

if (isVHook(value) && value.namespace) {
   ret += ' ' + createAttribute(name, value.value, true);
   continue;
}

As an example this test fails if added:

it('should render hooks', function () {
  var node = h('input', { type: 'submit', value: 'add' });
  assert.equal(toHTML(node), '<input type="submit" value="add">');
});

Works with virtual-dom/vnode/vnode but not vtree/vnode

Hi,

These implementations look very similar to me:

https://github.com/Matt-Esch/virtual-dom/blob/master/vnode/vnode.js
https://github.com/Matt-Esch/vtree/blob/master/vnode.js

However the latter is resulting in an empty result. test:

var toHTML = require('vdom-to-html');

var VNode = require('virtual-dom/vnode/vnode');
// var VNode = require('vtree/vnode'); // Doesn't work

toHTML(new VNode('input', { className: 'name', type: 'text' }));

Currently https://github.com/Raynos/mercury is not working either, I'm wondering if it's also using a vnode which is incompatible?

Thanks

consider handling svg?

Since virtual-dom 1.1 added better support for svg attributes, though our use-case doesn't require changing svg content, innerHTML works fine for now.

charset shouldn't be charSet

Discovered this when I try to convert h('meta', { charset: 'UTF-8' }) to no avail.

I don't know why React is doing that, but I can't think of any instance where charSet is used in DOM, they should all be charset. Maybe React has different behaviour internally? Can't tell from related pull request.

In DOM:

screen shot 2015-01-14 at 11 30 17 pm

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.