From: alexlamsl Date: Wed, 17 Feb 2016 20:41:16 +0000 (+0800) Subject: integrate tag omission rules from WhatWG X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=3ab98e86434857511dc33a68b32d9e8b9c334378;p=html-minifier.git integrate tag omission rules from WhatWG fixes #497 --- diff --git a/dist/htmlminifier.js b/dist/htmlminifier.js index 49061fc..5fedfe0 100644 --- a/dist/htmlminifier.js +++ b/dist/htmlminifier.js @@ -922,17 +922,48 @@ return text.replace(reStartDelimiter[tag], '').replace(reEndDelimiter[tag], ''); } - // Tag omission rules from http://www.w3.org/TR/html5/syntax.html#optional-tags - var optionalStartTags = createMapFromString('html,head,body'); - var optionalEndTags = createMapFromString('html,head,body,li,dt,dd,p,rb,rt,rtc,rp,optgroup,option,colgroup,thead,tbody,tfoot,tr,td,th'); - var headerTags = createMapFromString('meta,link,script,style,template'); + // Tag omission rules from https://html.spec.whatwg.org/multipage/syntax.html#optional-tags + // with the following deviations: + // - retain if followed by