assetgraph
Advanced tools
Comparing version 0.3.3 to 0.3.4
var util = require('util'), | ||
_ = require('underscore'), | ||
cssom = require('../3rdparty/CSSOM/lib'), | ||
cssom = require('cssom-papandreou'), | ||
cssmin = require('cssmin'), | ||
@@ -5,0 +5,0 @@ extendWithGettersAndSetters = require('../util/extendWithGettersAndSetters'), |
@@ -327,3 +327,3 @@ var util = require('util'), | ||
// <!--[if !IE]> --> ... <!-- <![endif]--> | ||
var matchNonInternetExplorerConditionalComment = node.nodeValue.match(/^\[if !IE\]><!\s*$/); | ||
var matchNonInternetExplorerConditionalComment = node.nodeValue.match(/^\[if !IE\]>\s*$/); | ||
if (matchNonInternetExplorerConditionalComment) { | ||
@@ -346,3 +346,3 @@ var queueIndex = 0, | ||
node: node, | ||
endNode: cursor | ||
endNode: queue.shift() | ||
})); | ||
@@ -410,7 +410,8 @@ foundEndMarker = true; | ||
// FIXME: Create superclass for Html* relations and put this method there? | ||
_attachNode: function (node, position, adjacentNode) { | ||
_attachNode: function (node, position, adjacentRelation) { | ||
if (position !== 'before' && position !== 'after') { | ||
throw new Error("assets.Html._attachNode: The 'position' parameter must be either 'before' or 'after'"); | ||
} | ||
var parentNode = adjacentNode.parentNode; | ||
var adjacentNode = (position === 'after' && adjacentRelation.endNode) || adjacentRelation.node, | ||
parentNode = adjacentNode.parentNode; | ||
if (!parentNode) { | ||
@@ -417,0 +418,0 @@ throw new Error("assets.Html._attachNode: Adjacent node has no parentNode."); |
@@ -33,3 +33,3 @@ /*global require, exports*/ | ||
this.node.setProperty('type', this.to.contentType); | ||
asset._attachNode(this.node, position, adjacentRelation.node); | ||
asset._attachNode(this.node, position, adjacentRelation); | ||
return Relation.prototype.attach.call(this, asset, position, adjacentRelation); | ||
@@ -36,0 +36,0 @@ }, |
@@ -31,3 +31,3 @@ /*global require, exports*/ | ||
this.node = asset.parseTree.createElement('a'); | ||
asset._attachNode(this.node, position, adjacentRelation.node); | ||
asset._attachNode(this.node, position, adjacentRelation); | ||
return Relation.prototype.attach.call(this, asset, position, adjacentRelation); | ||
@@ -34,0 +34,0 @@ }, |
@@ -32,3 +32,3 @@ /*global require, exports*/ | ||
this.node = asset.parseTree.createElement('applet'); | ||
asset._attachNode(this.node, position, adjacentRelation.node); | ||
asset._attachNode(this.node, position, adjacentRelation); | ||
return Relation.prototype.attach.call(this, asset, position, adjacentRelation); | ||
@@ -35,0 +35,0 @@ }, |
@@ -31,3 +31,3 @@ /*global require, exports*/ | ||
this.node = asset.parseTree.createElement('audio'); | ||
asset._attachNode(this.node, position, adjacentRelation.node); | ||
asset._attachNode(this.node, position, adjacentRelation); | ||
return Relation.prototype.attach.call(this, asset, position, adjacentRelation); | ||
@@ -34,0 +34,0 @@ }, |
@@ -41,3 +41,3 @@ /*global require, exports*/ | ||
this.node = asset.parseTree.createComment(); | ||
asset._attachNode(this.node, position, adjacentRelation.node); | ||
asset._attachNode(this.node, position, adjacentRelation); | ||
if (this.condition === '!IE') { | ||
@@ -44,0 +44,0 @@ this.node.nodeValue = '[if !IE]>'; |
@@ -28,3 +28,3 @@ /*global require, exports*/ | ||
this.node = asset.parseTree.createElement('esi:include'); | ||
asset._attachNode(this.node, position, adjacentRelation.node); | ||
asset._attachNode(this.node, position, adjacentRelation); | ||
return Relation.prototype.attach.call(this, asset, position, adjacentRelation); | ||
@@ -31,0 +31,0 @@ }, |
@@ -31,3 +31,3 @@ /*global require, exports*/ | ||
this.node = asset.parseTree.createElement('embed'); | ||
asset._attachNode(this.node, position, adjacentRelation.node); | ||
asset._attachNode(this.node, position, adjacentRelation); | ||
return Relation.prototype.attach.call(this, asset, position, adjacentRelation); | ||
@@ -34,0 +34,0 @@ }, |
@@ -31,3 +31,3 @@ /*global require, exports*/ | ||
this.node = asset.parseTree.createElement('frame'); | ||
asset._attachNode(this.node, position, adjacentRelation.node); | ||
asset._attachNode(this.node, position, adjacentRelation); | ||
return Relation.prototype.attach.call(this, asset, position, adjacentRelation); | ||
@@ -34,0 +34,0 @@ }, |
@@ -31,3 +31,3 @@ /*global require, exports*/ | ||
this.node = asset.parseTree.createElement('iframe'); | ||
asset._attachNode(this.node, position, adjacentRelation.node); | ||
asset._attachNode(this.node, position, adjacentRelation); | ||
return Relation.prototype.attach.call(this, asset, position, adjacentRelation); | ||
@@ -34,0 +34,0 @@ }, |
@@ -31,3 +31,3 @@ /*global require, exports*/ | ||
this.node = asset.parseTree.createElement('img'); | ||
asset._attachNode(this.node, position, adjacentRelation.node); | ||
asset._attachNode(this.node, position, adjacentRelation); | ||
return Relation.prototype.attach.call(this, asset, position, adjacentRelation); | ||
@@ -34,0 +34,0 @@ }, |
@@ -32,3 +32,3 @@ /*global require, exports*/ | ||
this.node = asset.parseTree.createElement('object'); | ||
asset._attachNode(this.node, position, adjacentRelation.node); | ||
asset._attachNode(this.node, position, adjacentRelation); | ||
return Relation.prototype.attach.call(this, asset, position, adjacentRelation); | ||
@@ -35,0 +35,0 @@ }, |
@@ -51,3 +51,3 @@ /*global require, exports*/ | ||
} else { | ||
asset._attachNode(this.node, position, adjacentRelation.node); | ||
asset._attachNode(this.node, position, adjacentRelation); | ||
} | ||
@@ -54,0 +54,0 @@ return Relation.prototype.attach.call(this, asset, position, adjacentRelation); |
@@ -32,3 +32,3 @@ /*global require, exports*/ | ||
this.node.setAttribute('rel', 'shortcut icon'); // Hmm, how to handle apple-touch-icon? | ||
this.from._attachNode(this.node, position, adjacentRelation.node); | ||
asset._attachNode(this.node, position, adjacentRelation); | ||
return Relation.prototype.attach.call(this, asset, position, adjacentRelation); | ||
@@ -35,0 +35,0 @@ }, |
@@ -84,3 +84,3 @@ /*global require, exports*/ | ||
} else { | ||
asset._attachNode(this.node, position, adjacentRelation.node); | ||
asset._attachNode(this.node, position, adjacentRelation); | ||
} | ||
@@ -87,0 +87,0 @@ return Relation.prototype.attach.call(this, asset, position, adjacentRelation); |
@@ -31,3 +31,3 @@ /*global require, exports*/ | ||
this.node = asset.parseTree.createElement('video'); | ||
this.from._attachNode(this.node, position, adjacentRelation.node); | ||
asset._attachNode(this.node, position, adjacentRelation); | ||
return Relation.prototype.attach.call(this, asset, position, adjacentRelation); | ||
@@ -34,0 +34,0 @@ }, |
var _ = require('underscore'), | ||
cssom = require('../3rdparty/CSSOM/lib'), | ||
cssom = require('cssom-papandreou'), | ||
assets = require('../assets'), | ||
@@ -4,0 +4,0 @@ relations = require('../relations'); |
@@ -19,6 +19,8 @@ var _ = require('underscore'), | ||
cssImages.forEach(function (cssImage) { | ||
if (cssImage.cssRule.style.getPropertyValue('-one-image-inline') || | ||
(sizeThreshold >= 0 && cssImage.to.rawSrc.length <= sizeThreshold) && assetGraph.findRelations({from: cssAsset, to: cssImage.to}).length === 1) { | ||
if (cssImage.cssRule.style.getPropertyValue('-one-image-inline')) { | ||
cssImage.cssRule.style.removeProperty('-one-image-inline'); | ||
cssAsset.markDirty(); | ||
cssImagesToInline.push(cssImage); | ||
} else if (sizeThreshold >= 0 && cssImage.to.rawSrc.length <= sizeThreshold && assetGraph.findRelations({from: cssAsset, to: cssImage.to}).length === 1) { | ||
cssImagesToInline.push(cssImage); | ||
} | ||
@@ -25,0 +27,0 @@ }); |
@@ -11,3 +11,3 @@ var _ = require('underscore'), | ||
return function populate(assetGraph, cb) { | ||
var assetQueue = assetGraph.findAssets(options.from), | ||
var assetQueue = assetGraph.findAssets(_.extend({isInline: false}, options.from)), | ||
maxWaitingCallbacks = options.concurrency || 100, | ||
@@ -51,4 +51,4 @@ numWaitingCallbacks = 0, | ||
if (outgoingRelation.to.isInline) { | ||
Array.prototype.push.apply(externalRelations, gatherExternalRelations(outgoingRelation.to)); | ||
} else { | ||
gatherExternalRelations(outgoingRelation.to); | ||
} else if (!outgoingRelation.to.isAsset) { | ||
externalRelations.push(outgoingRelation); | ||
@@ -55,0 +55,0 @@ } |
@@ -5,3 +5,3 @@ { | ||
"repository": "git://github.com/One-com/assetgraph.git", | ||
"version": "0.3.3", | ||
"version": "0.3.4", | ||
"maintainers": [ | ||
@@ -29,3 +29,4 @@ { | ||
"htmlparser": ">=1.7.0", | ||
"jsdom": "=0.2.3" | ||
"jsdom": "=0.2.4", | ||
"cssom-papandreou": "=0.2.0-patch1" | ||
}, | ||
@@ -41,3 +42,3 @@ "devDependencies": { | ||
}, | ||
"publicationConfig": { | ||
"publishConfig": { | ||
"registry": "http://registry.npmjs.org/" | ||
@@ -44,0 +45,0 @@ }, |
@@ -27,4 +27,4 @@ var vows = require('vows'), | ||
}, | ||
'the graph should contain 4 HtmlConditionalComment relations': function (assetGraph) { | ||
assert.equal(assetGraph.findRelations({type: 'HtmlConditionalComment'}).length, 4); | ||
'the graph should contain 13 HtmlConditionalComment relations': function (assetGraph) { | ||
assert.equal(assetGraph.findRelations({type: 'HtmlConditionalComment'}).length, 13); | ||
}, | ||
@@ -39,6 +39,6 @@ 'the graph should contain 3 inline CssImage relations': function (assetGraph) { | ||
}, | ||
'the Html asset should contain 2 non-IE conditional comment markers': function (assetGraph) { | ||
'the Html asset should contain 5 non-IE conditional comment markers': function (assetGraph) { | ||
var captures = assetGraph.findAssets({type: 'Html'})[0].text.match(/<!--\[if !IE\]>-->/g); | ||
assert.isNotNull(captures); | ||
assert.equal(captures.length, 2); | ||
assert.equal(captures.length, 5); | ||
}, | ||
@@ -45,0 +45,0 @@ 'the Html asset should contain 2 IE conditional comment markers with link tags in them': function (assetGraph) { |
Sorry, the diff of this file is not supported yet
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
0
591265
17
314
10059
Updatedjsdom@=0.2.4