Giter Site home page Giter Site logo

domparser.js's Introduction

domparser

This is a pure JS implementation of DOM parsing, to be used instead of DOMParser in a browser. We use [sax.js] for the low-level parsing, and convert it to the browser's native Document object.

Why not use the built-in DOMParser?

The built-in DOMParser in modern browsers should be sufficient for most use cases. The missing features I've found:

  1. Error reporting is very different on the different browsers. Typically the browser also stops after the first error.
  2. It's not possible to get access to position info (what line/column an element is on).

This project aims to be a lightweight replacement for the built-in parser, with better error handling and position reporting.

Usage

var doc = new domparser.DOMParser().parseFromString("<test>xml</test>");

Supported browsers

Tested on recent versions of Chrome, Firefox and Safari, and on IE 9 and 10. Does not work on IE 8 and below.

Tested with the help of Travis and SauceLabs.

Build Status

License

All files in this project are under the MIT license.

domparser.js's People

Contributors

rkistner avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.