Skip to content

Commit

Permalink
Merge pull request #247 from canjs/no-can-util
Browse files Browse the repository at this point in the history
Remove can-util deps
  • Loading branch information
justinbmeyer authored May 26, 2018
2 parents 0b665d0 + b381b59 commit 3bc93bd
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 20 deletions.
4 changes: 2 additions & 2 deletions can-component.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ require('can-view-model');
require("can-define/list/list");

var domData = require('can-dom-data-state');
var getChildNodes = require('can-util/dom/child-nodes/child-nodes');
var string = require("can-util/js/string/string");
var getChildNodes = require('can-child-nodes');
var string = require("can-string");
var domEvents = require('can-dom-events');
var domMutate = require('can-dom-mutate');
var domMutateNode = require('can-dom-mutate/node');
Expand Down
4 changes: 2 additions & 2 deletions docs/beforeremove.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ An event called only on component’s elements before they are removed from the
document if live binding is performing the removal. It can be listened to
within a component’s [can-component.prototype.events] object or on a component
element with [can-stache-bindings.event] bindings. This is an additional
special event only on component elements. [can-util/dom/events/inserted/inserted]
and [can-util/dom/events/removed/removed] events are available on all elements.
special event only on component elements. Checkout [can-dom-mutate//events/events]
for other mutation events.

@signature `"{element} beforeremove": function(element, event)`

Expand Down
9 changes: 4 additions & 5 deletions docs/component.md
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ adds “!” to the message every time `<hello-world>` is clicked:
```js
Component.extend( {
tag: "hello-world",
view: stache( "<h1>{{message}}</h1>" ),
view: "<h1>{{message}}</h1>",
events: {
"click": function() {
const currentMessage = this.viewModel.message;
Expand All @@ -351,10 +351,9 @@ Component.extend( {
} );
```

Components have the ability to bind to special [can-util/dom/events/inserted/inserted],
[can-component/beforeremove] and [can-util/dom/events/removed/removed] events
that are called when a component’s tag has been inserted into,
is about to removed, or was removed from the page.
Use [can-component/connectedCallback] to listen to when an component's element
is inserted or removed from the DOM.


### Helpers

Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,25 +38,27 @@
},
"dependencies": {
"can-assign": "^1.1.1",
"can-child-nodes": "^1.0.0",
"can-construct": "^3.2.0",
"can-control": "^4.0.0",
"can-define": "^2.0.0",
"can-dom-data-state": "^1.0.1",
"can-dom-events": "^1.1.0",
"can-dom-mutate": "^1.0.0",
"can-fragment": "^1.0.0",
"can-globals": "^1.0.0",
"can-log": "^1.0.0",
"can-namespace": "1.0.0",
"can-observation": "^4.0.0",
"can-queues": "^1.0.0",
"can-reflect": "^1.6.0",
"can-simple-map": "^4.0.0",
"can-simple-map": "^4.1.0",
"can-simple-observable": "^2.0.0",
"can-stache": "^4.1.0",
"can-stache-bindings": "^4.0.3",
"can-stache-key": "^1.0.0",
"can-string": "0.0.5",
"can-symbol": "^1.4.1",
"can-util": "^3.9.5",
"can-view-callbacks": "^4.0.0",
"can-view-model": "^4.0.0",
"can-view-nodelist": "^4.0.0",
Expand Down
2 changes: 1 addition & 1 deletion test/component-define-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ var define = require("can-define");
var DefineMap = require("can-define/map/map");

var viewModel = require("can-view-model");
var canDev = require("can-util/js/dev/dev");
var canDev = require("can-log/dev/dev");
var testHelpers = require("can-test-helpers");

QUnit.module("can-component with can-define");
Expand Down
2 changes: 1 addition & 1 deletion test/component-view-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ var insertedEvent = domMutateDomEvents.inserted;
var canViewModel = require('can-view-model');
var DefineMap = require("can-define/map/map");
var queues = require("can-queues");
var getFragment = require("can-util/dom/fragment/fragment");
var getFragment = require("can-fragment");
var viewCallbacks = require("can-view-callbacks");
var Scope = require("can-view-scope");
var observe = require("can-observe");
Expand Down
2 changes: 1 addition & 1 deletion test/example-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ var canViewModel = require("can-view-model");
var domMutateNode = require('can-dom-mutate/node');
var domMutateDomEvents = require('can-dom-mutate/dom-events');
var insertedEvent = domMutateDomEvents.inserted;
var canLog = require("can-util/js/log/log");
var canLog = require("can-log");
var queues = require("can-queues");

var innerHTML = function(el) {
Expand Down
15 changes: 9 additions & 6 deletions test/helpers.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
var MUTATION_OBSERVER = require('can-util/dom/mutation-observer/mutation-observer');
var DOCUMENT = require("can-util/dom/document/document");
var MUTATION_OBSERVER = require('can-globals/mutation-observer/mutation-observer');
var globals = require("can-globals");
var DOCUMENT = require("can-globals/document/document");
var makeDocument = require('can-vdom/make-document/make-document');
var domMutate = require('can-dom-mutate');
var domMutateNode = require('can-dom-mutate/node');
Expand All @@ -20,16 +21,18 @@ var helpers = {
},
makeTest: function(name, doc, mutObs, test, qUnitTest) {
var DOC = DOCUMENT();
var MUT_OBS = MUTATION_OBSERVER();
//var MUT_OBS = MUTATION_OBSERVER();

QUnit.module(name, {
setup: function () {
DOCUMENT(doc);
MUTATION_OBSERVER(mutObs);
if(!mutObs) {
globals.setKeyValue("MutationObserver", mutObs);
}


if(doc) {
this.document = doc;
this.document = doc;
this.fixture = doc.createElement("div");
doc.body.appendChild(this.fixture);
} else {
Expand All @@ -42,7 +45,7 @@ var helpers = {
setTimeout(function(){
start();
DOCUMENT(DOC);
MUTATION_OBSERVER(MUT_OBS);
globals.deleteKeyValue("MutationObserver");
}, 100);
}
});
Expand Down

0 comments on commit 3bc93bd

Please sign in to comment.