Skip to content

Commit

Permalink
More compress
Browse files Browse the repository at this point in the history
  • Loading branch information
miripiruni committed Feb 16, 2017
1 parent 5292523 commit ee703d6
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 28 deletions.
18 changes: 9 additions & 9 deletions lib/bemhtml/entity.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ Entity.prototype.init = function init(block, elem) {
};

Entity.prototype._keys = {
tag: true,
content: true,
attrs: true,
mix: true,
js: true,
mods: true,
elemMods: true,
cls: true,
bem: true
tag: 1,
content: 1,
attrs: 1,
mix: 1,
js: 1,
mods: 1,
elemMods: 1,
cls: 1,
bem: 1
};

Entity.prototype.defaultBody = function defaultBody(context) {
Expand Down
19 changes: 10 additions & 9 deletions lib/bemxjst/entity.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ Entity.prototype.init = function init(block, elem) {
};

Entity.prototype._keys = {
content: true,
mix: true,
js: true,
mods: true,
elemMods: true
content: 1,
mix: 1,
js: 1,
mods: 1,
elemMods: 1
};

Entity.prototype._initRest = function _initRest(key) {
Expand All @@ -59,10 +59,6 @@ Entity.prototype._initRest = function _initRest(key) {
}
};

function contentMode() {
return this.ctx.content;
}

Entity.prototype.initModes = function initModes(templates) {
/* jshint maxdepth : false */
for (var i = 0; i < templates.length; i++) {
Expand Down Expand Up @@ -129,6 +125,11 @@ Entity.prototype.run = function run(context) {
return this.defaultBody(context);
};


function contentMode() {
return this.ctx.content;
}

Entity.prototype.setDefaults = function setDefaults() {
// Default .content() template for applyNext()
if (this.content.count !== 0)
Expand Down
19 changes: 9 additions & 10 deletions lib/bemxjst/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,14 @@ var singleQuot = '&#39;';

var matchXmlRegExp = /[&<>]/;

exports.xmlEscape = function(string) {
if (typeof string === 'undefined' ||
function isEmpty(string) {
return typeof string === 'undefined' ||
string === null ||
(typeof string === 'number' && isNaN(string))
)
(typeof string === 'number' && isNaN(string));
}

exports.xmlEscape = function(string) {
if (isEmpty(string))
return '';

var str = '' + string;
Expand Down Expand Up @@ -54,9 +57,7 @@ exports.xmlEscape = function(string) {
var matchAttrRegExp = /["&]/;

exports.attrEscape = function(string) {
if (typeof string === 'undefined' ||
string === null ||
(typeof string === 'number' && isNaN(string)))
if (isEmpty(string))
return '';

var str = '' + string;
Expand Down Expand Up @@ -97,9 +98,7 @@ exports.attrEscape = function(string) {
var matchJsAttrRegExp = /['&]/;

exports.jsAttrEscape = function(string) {
if (typeof string === 'undefined' ||
string === null ||
(typeof string === 'number' && isNaN(string)))
if (isEmpty(string))
return '';

var str = '' + string;
Expand Down

0 comments on commit ee703d6

Please sign in to comment.