-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
this.$() failing when tagName is set to empty #4837
Comments
I think that's expected behaviour. this.$() gets the HTML element... there isn't one... so what would you expect it to do? |
You should probably be using a span tag IMO. I guess your expectation was that this.$() would get you the HTML node, (ie in your case the textNode), but that's not what it does. It gets the HTML element. |
I understand the issue, and it makes sense, but maybe there should be an error message or something? I'm not sure exactly, but It would be good to save someone else the time of finding out like i did. Maybe even just a note in the docs? |
A component should have an element. It's a bit of a strange use case to have no tag on a component, isn't it? I'm pretty surprised anyone would actually do that. I don't think it's the framework's job to tell you if you're doing something not quite correctly. That's what an IDE or documentation or other programmers helping you is for. Otherwise you'd end up with a framework which had every possible error anyone had ever made in it bloating out the codebase. |
This is applicable to all Views, not just components. An example use case is if you had a view/component that contains two tr tags, any wrapper around them will break clean DOM. That said, I'm not sure what the ember policy in this kind of issue is, hence while I opened and issue instead of submitting a PR. Happy to close if this is out of scope and such. |
what should $() return if there is no tagName? Your immediate children could be a collection, is that would |
Hi! I've just ran into this issue, and I agree with @responsis that this is a valid scenario. I think there is no problem with the I would expect it to return the child elements in the jQuery object if the tagName property is ''. |
There is a way to have no tag on a view (inheriting from Until then, we just don't support See discussion here |
I know jQuery is being phased out as a dependency soon, but this cost me an hour:
http://jsfiddle.net/6Evrq/73/
this.$() fails when tagName === ''
I'm not sure what could be done about this, but thought I would report it anyway.
The text was updated successfully, but these errors were encountered: