Raynos / min-document

A minimal DOM implementation
MIT License
109 stars 27 forks source link

Handle non string attribute/property value #46

Open Javey opened 8 years ago

Javey commented 8 years ago

Everyone is discussing serialization #20 #31 , it's complex. How about this simple PR?

Fixed:

  1. Any attribute can be stringified if you set it by setAttribute. So :
    • div.setAttribute('data-null', null) should be serialized to <div data-null="null"></div> instead of <div data-null=""></div>
    • div.setAttribute('data-number', 0) should be serialized to <div data-number="0"></div> instead of <div data-number=""></div>
  2. The false property should not be serialized. So:
    • option.selected = false should be serialized to <option></option> instead of <option selected=""></option>