}
else if ( html.indexOf('<') === 0 ) {
match = html.match( startTag );
-
if ( match ) {
html = html.substring( match[0].length );
match[0].replace( startTag, parseStartTag );
if ( !tagName ) {
pos = 0;
}
- else { // Find the closest opened tag of the same type
+ else {
+ // Find the closest opened tag of the same type
+ var needle = tagName.toLowerCase();
for ( pos = stack.length - 1; pos >= 0; pos-- ) {
- if ( stack[ pos ].toLowerCase() === tagName ) {
+ if ( stack[ pos ].toLowerCase() === needle ) {
break;
}
}
equal(minify('<a href>ok</a>'), '<a href>ok</a>');
equal(minify('<a onclick></a>'), '<a onclick></a>');
+
+ // https://github.com/kangax/html-minifier/issues/229
+ equal(minify('<CUSTOM-TAG></CUSTOM-TAG><div>Hello :)</div>'), '<custom-tag></custom-tag><div>Hello :)</div>');
});
test('`minifiy` exists', function() {