Skip to content

HTMLdoc v1.2.0

Compare
Choose a tag to compare
@hexydec hexydec released this 08 May 15:12
· 133 commits to master since this release

This release fixes a number of bugs, improves performance and adds some features. Minified output will now also be smaller in certain cases:

  • HTMLdoc now implements \ArrayAccess to enable you to iterate through nodes when searching through documents
  • Improved performance and reliablility of how closing </script> and </style> are detected. Note that you cannot have for example a closing script tag in a javascript string, and still correctly detect the end of the tag, this is for performance reasons and this bug will remain
  • Split the tokenise() method off into its own project
  • Added tests/performance.php which downloads the HTML for 125 different wordpress sites and minifies them, the results are shown in a table
  • Added option to cache minified CSS and Javascript to files, which in performance.php halves the time it takes to process the sites
  • Improved how config is handled internally
  • Added SVG self-closing tags to the config to make sure that self-closing SVG tags are output correctly
  • Configuration is now handled within a separate class which HTMLdoc extends, to make the code more manageable
  • Removed functionality that sorted class names in HTML attributes, as it didn't produce reliable reductions in size whilst taking on average a quarter of the total minification time
  • Updated the class setting in the attributes array to trim any unneeded whitespace from the class attribute
  • Fixed issue where attribute values were trimmed in tag::minify() when $minify['attributes'] was set regardless of the contained settings, it is now contained in a new setting $minify['attributes']['trim']
  • Updated tag::html() to improve how attributes are encoded, now only & and < plus the quote specified as the quote style is encoded
  • Expanded the functionality of the minimal setting in tag::html() to switch to single quotes when there are double quotes in the attribute value to make the encoded output smaller
  • Moved all files up a level in the src folder as it is pointless the files being in another folder
  • Fixed bugs in tag::parse() and tag::parseChildren() where missing closing tags were not handled correctly, before the system only checked the parent tag to know whether the closing tag was missing and didn't handle a closing parent tag correctly. It now closes all tags up to the close tag that is detected, otherwise they are discarded, and uses the entire parent tag chain to detect this
  • String comparisons are now strict where possible
  • Fixed bug in htmldoc::open() where the charset could end up being set to false, which then caused the load() method to fail
  • Fixed issue in tag::html() where the attribute value can be null, but it wasn't converted to a string for a string operation
  • Explicitly namespaced all native functions into the root namespace, as it is clearer and performs better
  • Updated config::__construct() to only recursively merge the config when a custom config has been supplied
  • Reworked script::minify() and style::minify() to implement caching which is controlled by a config
  • Restructured the custom config for style and script to make it simpler