-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
automatically calling tagHandler for tags in the document #77
Conversation
can-view-callbacks.js
Outdated
|
||
//!steal-remove-start | ||
var requestedAttributes = {}; | ||
//!steal-remove-end | ||
|
||
var tags = {}; | ||
|
||
var GLOBAL = getGlobal(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't cache this. Even thought this feature will (likely) never run in SSR, having this here might mean someone else uses it in code that will.
can-view-callbacks.js
Outdated
var mountedElements = new WeakSet(); | ||
|
||
var mountNodeAndChildrenIfNecessary = function(node) { | ||
var tagName = node.tagName && node.tagName.toLowerCase(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: node.localName
is already lower case
can-view-callbacks.js
Outdated
}; | ||
|
||
var obs = new MutationObserver(mutationHandler); | ||
obs.observe(GLOBAL.document.documentElement, { childList: true, subtree: true }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use getGlobal or getDocument
can-view-callbacks.js
Outdated
}; | ||
|
||
var mountExistingElements = function(tagName) { | ||
var nodes = GLOBAL.document.getElementsByTagName(tagName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getGlobal or getDocument
I'm a little confused about the flow here. How is anything ever added to |
|
What does "mounted" mean exactly? Does it mean that the tag handler has been called on it? |
Yes. If in |
I'm open to ideas for a better name. |
So in that case do we need stache to do the job of adding to mountedElements? Can callbacks not do it here? can-view-callbacks/can-view-callbacks.js Line 204 in 58fe035
|
Yes, you're right we can do it there. I don't think we need the viewModel check either. I'll update the code and tests. |
🎉 |
first piece of #75.