Skip to content

Conversation

@webcrx
Copy link

@webcrx webcrx commented May 16, 2014

i need this to work with UI.body

@cmather
Copy link
Owner

cmather commented May 16, 2014

Hi @webcrx, Thanks for this. Someone else discovered this as a solution a little while back also. I need to understand how/why it works. It seems strange that any layout would need to inherit from UI.body vs. just being plugged into UI.body. I also mechanically don't understand why it works. I'm hesitant to duct tape symptoms even if it seemingly fixes the problem. But haven't had time to dive in. Maybe the fastest thing is to ask Core.

@dgreensp: What is the correct way to render a component as a child of the UI.body component such that UI.body event handlers respond to events from child components? I thought passing the UI.body component as a parma to UI.render was enough, but it does not seem to work. If it's not a trivial answer and you'd like a reproduction please let me know and happy to share.

@cmather
Copy link
Owner

cmather commented May 16, 2014

@dgreensp: if you get a chance I referenced you in a question above but didn't get your github handle right the first time :). Asking about rendering components as children of UI.body and making sure event handlers still fire on UI.body.

@webcrx
Copy link
Author

webcrx commented May 16, 2014

I posted that because only with that fix (for now) i can use global event in all templates without copy code :)
I'm using Meteor 0.8.1.2 for now but i read earlier that "bug" will be fixed in version 0.8.1

@dgreensp
Copy link

UI.body... is kind of a misnomer. Avi asked me about this recently, so
it's on my mind.

UI.body is a component that renders the concatenation of the <body> tags
in your .html files. We should change the name to something like UI.main.
Event handlers don't apply to new elements at the top level of the body,
because UI.body's DOMRange only covers elements it adds. Worse than that,
you can't use UI.body to attach event handlers to the BODY element (because
it isn't part of UI.body's range). So a click on UI.body really means a
click on a top-level element in one of your body tags, not the DOM body
itself (which may itself not cover the whole document/window).

I think we should rename UI.body to UI.main, and then make a new UI.body,
or perhaps UI.global. Maybe we can avoid making people worry about the
window/document/body distinction.

On Fri, May 16, 2014 at 8:23 AM, Chris Mather notifications@github.comwrote:

@dgreensp https://github.com/dgreensp: if you get a chance I referenced
you in a question above but didn't get your github handle right the first
time :). Asking about rendering components as children of UI.body and
making sure event handlers still fire on UI.body.


Reply to this email directly or view it on GitHubhttps://github.com//pull/21#issuecomment-43344215
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants