-
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
164 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"hooks": { | ||
"commit-msg": "commitlint -e $HUSKY_GIT_PARAMS", | ||
"pre-commit": "lint-staged" | ||
"pre-commit": "npm test && lint-staged" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
language: node_js | ||
node_js: | ||
- stable | ||
- stable | ||
cache: | ||
directories: | ||
- node_modules | ||
directories: | ||
- node_modules | ||
install: | ||
- npm install | ||
- npm install | ||
script: | ||
- npm run lint | ||
- npm run dtslint | ||
- npm run cover | ||
after_script: | ||
- npm run coveralls | ||
- npm run lint | ||
- npm run dtslint | ||
- npm run test:coverage | ||
after_success: | ||
- npm run coveralls | ||
notifications: | ||
email: false | ||
email: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<textarea cols="50" rows="5"><div>text</div></textarea> | ||
<pre><code></code></pre> | ||
<script src="../dist/html-dom-parser.min.js"></script> | ||
<script> | ||
var code = document.querySelector('code'); | ||
var textarea = document.querySelector('textarea'); | ||
|
||
function renderOutput(event) { | ||
cache = []; | ||
code.innerText = JSON.stringify( | ||
window.HTMLDOMParser(event.target.value), | ||
replacer, | ||
2 | ||
); | ||
} | ||
|
||
textarea.addEventListener('input', renderOutput); | ||
renderOutput({ target: textarea }); | ||
|
||
/** | ||
* @see {@link https://stackoverflow.com/questions/11616630/json-stringify-avoid-typeerror-converting-circular-structure-to-json} | ||
*/ | ||
var cache; | ||
function replacer(key, value) { | ||
if (typeof value === 'object' && value !== null) { | ||
if (cache.indexOf(value) !== -1) { | ||
// duplicate reference found | ||
return '[Circular]'; | ||
} | ||
// store value in our collection | ||
cache.push(value); | ||
} | ||
return value; | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters