Skip to content

Commit

Permalink
Merge pull request #60 from canjs/major
Browse files Browse the repository at this point in the history
{WIP @ 4.0} Updates
  • Loading branch information
justinbmeyer committed Jan 27, 2018
2 parents 6f3c8ef + 5ff86eb commit be171fd
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 46 deletions.
3 changes: 2 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
!dist/
!dist/
!test/
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package-lock=false
21 changes: 0 additions & 21 deletions build.js

This file was deleted.

26 changes: 13 additions & 13 deletions can-view-target.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
/* 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-util/dom/mutate/mutate');
var domMutate = require('can-dom-mutate/node');
var namespace = require('can-namespace');
var MUTATION_OBSERVER = require('can-globals/mutation-observer/mutation-observer');

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

var cloned = testFrag.cloneNode(true);

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

if(node.attributes) {
var attributes = makeArray(node.attributes);
each(attributes, function (node) {
if(node && node.specified) {
domAttr.setAttribute(copy, node.nodeName || node.name, node.nodeValue || node.value);
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);
}
});
}
}

if(node && node.firstChild) {
Expand Down Expand Up @@ -165,7 +162,7 @@ function processNode(node, paths, location, document){
callback: value
});
} else {
domAttr.setAttribute(el, attrName, value);
domMutate.setAttribute.call(el, attrName, value);
}
}
}
Expand Down Expand Up @@ -264,7 +261,10 @@ function makeTarget(nodes, doc){
clone: frag,
hydrate: function(){
var cloned = cloneNode(this.clone);
var args = makeArray(arguments);
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 callbacks = [];
for(var i = 0; i < paths.length; i++) {
Expand Down
17 changes: 6 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "can-view-target",
"version": "3.1.6",
"version": "4.0.0-pre.1",
"description": "Fast cloning micro templates",
"homepage": "http://canjs.com",
"repository": {
Expand All @@ -13,18 +13,15 @@
"url": "http://bitovi.com"
},
"scripts": {
"preversion": "npm test && npm run build",
"version": "git commit -am \"Update dist for release\" && git checkout -b release && git add -f dist/",
"postversion": "git push --tags && git checkout master && git branch -D release && git push",
"preversion": "npm test",
"postpublish": "git push --tags && git push",
"testee": "testee test/test.html --browsers firefox",
"test": "npm run detect-cycle && npm run jshint && npm run testee",
"jshint": "jshint ./*.js --config",
"release:pre": "npm version prerelease && npm publish --tag=pre",
"release:patch": "npm version patch && npm publish",
"release:minor": "npm version minor && npm publish",
"release:major": "npm version major && npm publish",
"build": "node build.js",
"develop": "done-serve --static --develop --port 8080",
"detect-cycle": "detect-cyclic-packages --ignore done-serve"
},
"main": "can-view-target",
Expand All @@ -34,12 +31,11 @@
"donejs"
],
"dependencies": {
"can-globals": "<2.0.0",
"can-namespace": "1.0.0",
"can-util": "^3.10.9"
"can-dom-mutate": "^1.0.0",
"can-globals": "^1.0.0",
"can-namespace": "1.0.0"
},
"devDependencies": {
"bit-docs": "0.0.7",
"can-simple-dom": "^1.0.2",
"detect-cyclic-packages": "^1.1.0",
"done-serve": "^1.0.0",
Expand All @@ -48,7 +44,6 @@
"jshint": "^2.9.1",
"steal": "^1.0.1",
"steal-qunit": "^1.0.0",
"steal-tools": "^1.0.0",
"testee": "^0.7.0"
}
}

0 comments on commit be171fd

Please sign in to comment.