Skip to content

Commit

Permalink
Merge pull request #59 from canjs/revert-58-magneto
Browse files Browse the repository at this point in the history
Revert "Use can-dom-mutate and drop can-util"
  • Loading branch information
andrejewski committed Dec 29, 2017
2 parents d13dfa5 + 68a5f34 commit 6f3c8ef
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
26 changes: 13 additions & 13 deletions can-view-target.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
/* jshint maxdepth:7 */
/* jshint latedef:false */
var childNodes = require('can-util/dom/child-nodes/child-nodes');
var domAttr = require('can-util/dom/attr/attr');
var each = require('can-util/js/each/each');
var makeArray = require('can-util/js/make-array/make-array');
var getDocument = require('can-globals/document/document');
var domMutate = require('can-dom-mutate/node');
var domMutate = require('can-util/dom/mutate/mutate');
var namespace = require('can-namespace');
var MUTATION_OBSERVER = require('can-globals/mutation-observer/mutation-observer');

Expand Down Expand Up @@ -29,7 +33,7 @@ var processNodes = function(nodes, paths, location, document){

var cloned = testFrag.cloneNode(true);

return cloned.firstChild.childNodes.length === 2;
return childNodes(cloned.firstChild).length === 2;
})(),
clonesWork = typeof document !== "undefined" && (function(){
// Since html5shiv is required to support custom elements, assume cloning
Expand Down Expand Up @@ -106,13 +110,12 @@ var cloneNode = clonesWork ?
}

if(node.attributes) {
var attributes = node.attributes;
for (var i = 0; i < attributes.length; i++) {
var attribute = attributes[i];
if (attribute && attribute.specified) {
domMutate.setAttribute.call(copy, attribute.nodeName || attribute.name, attribute.nodeValue || attribute.value);
var attributes = makeArray(node.attributes);
each(attributes, function (node) {
if(node && node.specified) {
domAttr.setAttribute(copy, node.nodeName || node.name, node.nodeValue || node.value);
}
}
});
}

if(node && node.firstChild) {
Expand Down Expand Up @@ -162,7 +165,7 @@ function processNode(node, paths, location, document){
callback: value
});
} else {
domMutate.setAttribute.call(el, attrName, value);
domAttr.setAttribute(el, attrName, value);
}
}
}
Expand Down Expand Up @@ -261,10 +264,7 @@ function makeTarget(nodes, doc){
clone: frag,
hydrate: function(){
var cloned = cloneNode(this.clone);
var args = [];
for (var a = 0, ref = args.length = arguments.length; a < ref; a++) {
args[a] = arguments[a];
} // see https://jsperf.com/nodelist-to-array
var args = makeArray(arguments);

var callbacks = [];
for(var i = 0; i < paths.length; i++) {
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@
"donejs"
],
"dependencies": {
"can-dom-mutate": "<2.0.0",
"can-globals": "<2.0.0",
"can-namespace": "1.0.0"
"can-namespace": "1.0.0",
"can-util": "^3.10.9"
},
"devDependencies": {
"bit-docs": "0.0.7",
Expand Down

0 comments on commit 6f3c8ef

Please sign in to comment.