Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore self closing slash #154

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
31 changes: 31 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"env": {
"browser": true,
"node": true
},
"globals": {},
"rules": {
"no-bitwise": 2,
"eqeqeq": 2,
"guard-for-in": 2,
"no-extend-native": 2,
"wrap-iife": [
2,
"any"
],
"no-use-before-define": [
2,
{
"functions": false
}
],
"no-caller": 2,
"no-empty": 2,
"no-irregular-whitespace": 2,
"no-new": 2,
"no-undef": 2,
"no-unused-vars": 2,
"no-unused-expressions": 0,
"dot-notation": 0
}
}
55 changes: 0 additions & 55 deletions .jscs.js

This file was deleted.

20 changes: 0 additions & 20 deletions .jshintrc

This file was deleted.

7 changes: 3 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
language: node_js

node_js:
- "0.10"
- "0.12"
- "4"
- "lts/*"
- "node"

env:
global:
- GH_REF: github.com/bem/html-differ.git
- GH_REF: github.com/markedjs/html-differ.git
- ISTANBUL_COVERAGE: true

after_success:
Expand Down
3 changes: 2 additions & 1 deletion lib/HtmlDiff.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ var diff = require('diff'),
* @param {String[]} [options.ignoreAttributes]
* @param {String[]} [options.compareAttributesAsJSON]
* @param {Boolean} [options.ignoreWhitespaces=true]
* @param {Boolean} [options.ignoreComments]
* @param {Boolean} [options.ignoreComments=true]
* @param {Boolean} [options.ignoreEndTags=false]
* @param {Boolean} [options.ignoreDuplicateAttributes=false]
* @param {Boolean} [options.ignoreSelfClosingSlash=false]
*/
var HtmlDiff = function (options) {
this.options = defaults(options);
Expand Down
4 changes: 3 additions & 1 deletion lib/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ var presets = {
* @param {Boolean} [options.ignoreComments=true]
* @param {Boolean} [options.ignoreEndTags=false]
* @param {Boolean} [options.ignoreDuplicateAttributes=false]
* @param {Boolean} [options.ignoreSelfClosingSlash=false]
* returns {Object}
*/
module.exports = function (options) {
Expand All @@ -39,7 +40,8 @@ var presets = {
ignoreComments: true,

ignoreEndTags: false,
ignoreDuplicateAttributes: false
ignoreDuplicateAttributes: false,
ignoreSelfClosingSlash: false
});
};

Expand Down
1 change: 1 addition & 0 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ HtmlDiff.prototype.tokenize = function (html) {
* @param {Boolean} [options.ignoreComments=true]
* @param {Boolean} [options.ignoreEndTags=false]
* @param {Boolean} [options.ignoreDuplicateAttributes=false]
* @param {Boolean} [options.ignoreSelfClosingSlash=false]
*/
var HtmlDiffer = function (options) {
options = defaults(options);
Expand Down
4 changes: 4 additions & 0 deletions lib/utils/modify.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ var SimpleApiParser = require('parse5').SimpleApiParser,
* @param {Boolean} [options.ignoreComments=true]
* @param {Boolean} [options.ignoreEndTags=false]
* @param {Boolean} [options.ignoreDuplicateAttributes=false]
* @param {Boolean} [options.ignoreSelfClosingSlash=false]
* returns {String}
*/
function modify(value, options) {
Expand All @@ -36,6 +37,9 @@ function modify(value, options) {
if (options.ignoreDuplicateAttributes) {
attrs = utils.removeDuplicateAttributes(attrs);
}
if (options.ignoreSelfClosingSlash) {
selfClosing = false;
}

attrs = utils.sortAttrs(attrs) &&
utils.sortCssClasses(attrs) &&
Expand Down
Loading