Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/skratchdot/domformat
domFormat is a simple javascript library to get DOM nodes as formatted/pretty strings.
https://github.com/skratchdot/domformat
Last synced: about 1 month ago
JSON representation
domFormat is a simple javascript library to get DOM nodes as formatted/pretty strings.
- Host: GitHub
- URL: https://github.com/skratchdot/domformat
- Owner: skratchdot
- Created: 2011-07-26T01:43:00.000Z (over 13 years ago)
- Default Branch: gh-pages
- Last Pushed: 2014-04-25T04:37:50.000Z (over 10 years ago)
- Last Synced: 2024-10-19T00:24:26.266Z (3 months ago)
- Language: JavaScript
- Homepage: http://projects.skratchdot.com/domFormat/bookmarklet/
- Size: 2.02 MB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
domFormat
===================### Description ###
domFormat is a simple javascript library to get DOM nodes as formatted/pretty
strings. It provides a simple API with 2 functions:```javascript
domFormat.init(settings);
domFormat.getString(node);
```I created it as a way to help compare the generated source of 2 pages when
doing development. Before creating this library, I had searched for another
library to do something similar, but everything I evaluated gave results
that were formatted slightly different than they way I wanted.
This code is designed to run in the browser, and uses the browser's native
DOM parsing to create a "prettified" string.### Links ###
[Source Code / Download](https://github.com/skratchdot/domFormat/)
[Examples](http://projects.skratchdot.com/domFormat/examples/index-html5.html)
[Bookmarklet](http://projects.skratchdot.com/domFormat/bookmarklet/index.html)### Libraries Used / Included ###
[CSS Beautify](https://github.com/senchalabs/cssbeautify)
- Originally written by Ariya Hidayat
- Copyright (C) 2011 Sencha Inc.
[JS Beautifier](https://github.com/einars/js-beautify)
- Originally written by Einar Lielmanis
### Browser Support ###
Most modern browsers are supported with the caveat that IE support/output
is somewhat strange.
IE Quirks/Bugs:* Tag names will be in all uppercase because IE doesn't support
node.prefix and node.localName when parsing DOM nodes* For the same reason above, namespaces will not be printed
correctly: <svg:svg /> will turn into <SVG />* <style /> and <script /> tags lose their contents
* Doctype nodes are treated as a comment (standards vs quirks mode)
### Version History ###
#### v1.4 - Released April 25, 2014
* Changing links from skratchdot.github.io -> projects.skratchdot.com
#### v1.3 - Released October 5, 2013
* Changing links from skratchdot.github.com -> skratchdot.github.io
#### v1.2 - Released November 17, 2012 ####
* Updating [CSS Beautify](https://github.com/senchalabs/cssbeautify)
* Updating [JS Beautifier](https://github.com/einars/js-beautify)
* Updating [Bookmarklet](http://projects.skratchdot.com/domFormat/bookmarklet/index.html)
#### v1.1 - Released November 6, 2012 ####
* Fixing IE bug when rendering Node.DOCUMENT_TYPE_NODE
* Reformatting source code.
#### v1.0 - Released July 25, 2011 ####
* Initial Release
* Known Bugs:
1. IE Quirks/Bugs listed in the Browser Support section above
2. Unsupported node types:
* Node.ENTITY_REFERENCE_NODE === 5
* Node.ENTITY_NODE === 6
* Node.PROCESSING_INSTRUCTION_NODE === 7
* Node.NOTATION_NODE === 12