hyperx icon indicating copy to clipboard operation
hyperx copied to clipboard

add support for custom-self-closing elements

Open JRJurman opened this issue 6 years ago • 0 comments

Hyperx Empty/ Void Tags PR

Hyperx does not have support for custom elements to have self-closing tags (#47)- so this PR adds such functionality.

This PR does break one of the previous tests, where hyperx makes assumptions on which elements automatically support self closing tags. However these assumptions are made at the cost of parsing through a very large array of possible self-closing tags. (See below) https://github.com/choojs/hyperx/blob/f3b880516823e9bfe714f026e67b3cfd5fcf410e/index.js#L265-L281

By removing this, we lose the functionality of being able to support widely known self-closing tags (such as <input> and <br>) but the cost is relatively small (changing <br> to <br /> and <input> to <input />) and has the benefit of support custom tags without adding them to a large list of supported closed tags.

Included in this PR to make up for the lost test, are two new tests, which confirm that existing and custom elements will support self-closing tags.

Work done by @jrjurman and @ethanjurman

JRJurman avatar Oct 14 '17 06:10 JRJurman