Comparing version 0.4.2 to 0.5.0
@@ -180,2 +180,13 @@ 'use strict'; | ||
/** | ||
* Return all direct descendents that are Elements. | ||
* This differs from `getChildren` in that it will exclude text nodes, | ||
* processing instructions, etc. | ||
*/ | ||
Element.prototype.getChildElements = function() { | ||
return this.getChildrenByFilter(function(child) { | ||
return child instanceof Element | ||
}) | ||
} | ||
/*** Builder ***/ | ||
@@ -182,0 +193,0 @@ |
@@ -280,2 +280,13 @@ (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
/** | ||
* Return all direct descendents that are Elements. | ||
* This differs from `getChildren` in that it will exclude text nodes, | ||
* processing instructions, etc. | ||
*/ | ||
Element.prototype.getChildElements = function() { | ||
return this.getChildrenByFilter(function(child) { | ||
return child instanceof Element | ||
}) | ||
} | ||
/*** Builder ***/ | ||
@@ -1157,2 +1168,9 @@ | ||
function noop() {} | ||
process.on = noop; | ||
process.once = noop; | ||
process.off = noop; | ||
process.emit = noop; | ||
process.binding = function (name) { | ||
@@ -1764,3 +1782,3 @@ throw new Error('process.binding is not supported'); | ||
}).call(this,require("/Users/lloyd/Dropbox/code/xmpp-ftw/ltx/node_modules/grunt-browserify/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"),typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) | ||
},{"./support/isBuffer":10,"/Users/lloyd/Dropbox/code/xmpp-ftw/ltx/node_modules/grunt-browserify/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":9,"inherits":8}]},{},[3]) | ||
}).call(this,require("/home/lloyd/Dropbox/code/node-xmpp/ltx/node_modules/grunt-browserify/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"),typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) | ||
},{"./support/isBuffer":10,"/home/lloyd/Dropbox/code/node-xmpp/ltx/node_modules/grunt-browserify/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":9,"inherits":8}]},{},[3]) |
{ | ||
"name": "ltx", | ||
"version": "0.4.2", | ||
"version": "0.5.0", | ||
"main": "./lib/index", | ||
@@ -5,0 +5,0 @@ "browser": "./lib/index-browserify", |
@@ -149,3 +149,35 @@ 'use strict'; | ||
}, | ||
'children': { | ||
'getChildren': function() { | ||
var el = new ltx.Element('a') | ||
.c('b') | ||
.c('b2').up().up() | ||
.t('foo') | ||
.c('c').t('cbar').up() | ||
.t('bar') | ||
.root() | ||
var children = el.children | ||
assert.equal(children.length, 4) | ||
assert.equal(children[0].name, 'b') | ||
assert.equal(children[1], 'foo') | ||
assert.equal(children[2].name, 'c') | ||
assert.equal(children[3], 'bar') | ||
}, | ||
'getChildElements': function() { | ||
var el = new ltx.Element('a') | ||
.c('b') | ||
.c('b2').up().up() | ||
.t('foo') | ||
.c('c').t('cbar').up() | ||
.t('bar') | ||
.root() | ||
var children = el.getChildElements() | ||
assert.equal(children.length, 2) | ||
assert.equal(children[0].name, 'b') | ||
assert.equal(children[1].name, 'c') | ||
} | ||
}, | ||
'recursive': { | ||
@@ -152,0 +184,0 @@ 'getChildrenByAttr': function() { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
100943
28
3005
25