Side navigation
#10262 closed bug (invalid)
Opened September 13, 2011 12:43PM UTC
Closed September 23, 2011 03:26PM UTC
Last modified September 27, 2011 12:33PM UTC
Empty attributes gives undefined!
Reported by: | doctor Rudolf | Owned by: | doctor Rudolf |
---|---|---|---|
Priority: | low | Milestone: | None |
Component: | attributes | Version: | 1.6.4rc1 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
alert($(‘#aaa’).attr(‘myattribute’)) gives "undefined" in IE8 - before 1.6.3 gave "".
Page:
<html> <head> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.3/jquery.min.js"></script> </head> <body> <form id="form1"> <input id="aaa" myattribute=""/> </form> </body> </html>
Attachments (0)
Change History (12)
Changed September 13, 2011 05:49PM UTC by comment:1
component: | unfiled → attributes |
---|---|
owner: | → doctor Rudolf |
priority: | undecided → low |
status: | new → pending |
Changed September 14, 2011 12:46PM UTC by comment:2
status: | pending → new |
---|
You CAN'T trigger it in Jsfiddle, we've tried.
It has to do with if a doctype is present or not and probably that is why it can't be triggered in Jsfiddle.
Please create the two files below and run them in IE8.
Paste this code in returnsUNDEFINED.aspx:
<html> <head> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.3/jquery.min.js"></script> </head> <body> <form id="form1"> <input id="in" emptyattr="" /> </form> </body> </html> <script> $(function () { alert($('#in').attr('emptyattr')); }); </script>
Paste this code in to returnsEmptyString.aspx
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.3/jquery.min.js"></script> </head> <body> <form id="form1"> <input id="in" emptyattr="" /> </form> </body> </html> <script> $(function () { alert($('#in').attr('emptyattr')); }); </script>
Then try changing 1.6.4 to 1.6.2 and see the difference. Surely 1.6.2 behaviour must be the correct one, don't you think?
We also recommend you to upgrade this ticket to a higher priority.
Changed September 14, 2011 02:23PM UTC by comment:3
status: | new → pending |
---|
There is no reason why a bug can't be reproduced on jsfiddle. This is probably an indication that the bug is no longer present. I noticed you are not testing against 1.6.4, but actually 1.6.3. Nevertheless, the most up-to-date version is the git version (also called edge) on http://jsfiddle.net. Please reproduce there for us.
Changed September 15, 2011 07:15AM UTC by comment:4
Mr Wil
Please don't give me that. I am a developer with 18 years of experience. Before I file a ticket I do my outmost not to bother guys like you with untested things. I have also gone through the this bug with collegues of mine that are gurus.
I write again: "...It has to do with if a doctype is present or not and probably that is why it can't be triggered in Jsfiddle. ...".
It might not be clear, but we've tested it in 1.6.4 - read between the lines ("...Then try changing 1.6.4...") might give you a hint. 1.6.4 was not released here in Sweden when we did the test. The day before we did tests with 1.6.4R1.
Please take some time and and do my recommended tests in IE8 - and be suprised when it don't work in plain files but in jsfiddle.
I don't write this ticket with the purpose of giving you more work - I write it solely because I believe in JQuery and the Jquery community.
Regards
Changed September 20, 2011 08:29AM UTC by comment:5
Anything?
Changed September 23, 2011 06:32AM UTC by comment:6
Replying to [comment:3 timmywil]:
Would you like me to open a new ticket or can you review my comments on the existing one?
Changed September 23, 2011 01:31PM UTC by comment:7
Sorry, I didn't see your previous comments. There really isn't a reason why a bug of this nature (as in it does not rely on a certain ajax response) can't be reproduced on jsfiddle. We ask for this because in the process of creating a fiddle, users will often realize that the problem was not with jQuery, but with their own code or environment. It is not meant to insult, but is rather a tool to help us narrow down the large number of tickets we receive. We also ask for jsfiddle test cases so that the code will be hosted and easily editable by the bugs team so that we can easily investigate the problem.
We do appreciate any contributions to the project, but we also need help narrowing down issues.
Changed September 23, 2011 03:26PM UTC by comment:8
resolution: | → invalid |
---|---|
status: | pending → closed |
ajpiano has noticed that the html listed in this ticket is invalid. Nothing should be placed outside of the <html> tag, including scripts. It may be that this works anyway in most browsers, but IE8 is more strict about it, especially in quirksmode. If the script tag is placed inside of html and you have a doctype on the page and there is still an issue, we can reopen this ticket.
Changed September 23, 2011 04:37PM UTC by comment:9
_comment0: | I was able to reproduce this problem in IE7 and 1.6.3/1.6.4 by creating a test page, but the problem does not exist in http://code.jquery.com/jquery-git.js so it should be gone as of 1.7. \ \ As timmywil says, we ask for complete and working test cases so we can be sure that we are seeing exactly what you are seeing. When we have to copy/paste code from place to place using snippets in the ticket, it greatly increases our effort time and effort. We get about 10 new tickets a day, we can't afford to volunteer time debugging incomplete bug reports. → 1316800500850842 |
---|
I was able to reproduce this problem in IE7 and 1.6.3/1.6.4 by creating a test page, but the problem does not exist in http://code.jquery.com/jquery-git.js so it should be gone as of 1.7.
As timmywil says, we ask for complete and working test cases so we can be sure that we are seeing exactly what you are seeing. When we have to copy/paste code from place to place using snippets in the ticket, it greatly increases our debugging time and effort. We get about 10 new tickets a day, we can't afford to volunteer time debugging incomplete bug reports.
Changed September 26, 2011 08:12PM UTC by comment:10
I just updated our Jquery to 1.6.4 and can confirm this is a problem in IE8.
I cannot get jsfiddle to work in IE8. I get a javascript error when I switch the framework to jquery; otherwise I would be happy to provide you an exmaple.
Since it is confirmed to be a bug is someone gonna fix it.
Changed September 26, 2011 09:03PM UTC by comment:11
create the fiddle in another browser, you will still be able to run it in IE8
Changed September 27, 2011 12:33PM UTC by comment:12
Finally got jsfiddle to work...kinda. Every time, I hit RUN it still throws a js error (Object does not support this property or method) but when I hit UPDATE it will refresh the page and run my example.
Regardless, I agree with Rudolf. The same bug does not happen in jsfiddle. Here is the example I tried: http://jsfiddle.net/xJfpX/15/
When I do the same thing in a mock page it does not return an empty string but an undefined.
Since it is confirmed to be a bug comment #9 is someone gonna change the ticket from invalid to open or is a 1.7 release right around the corner?
Thanks for taking the time to contribute to the jQuery project! Please provide a complete reduced test case on jsFiddle to help us assess your ticket.
Additionally, be sure to test against the jQuery Edge version to ensure the issue still exists. To get you started, use this boilerplate: http://jsfiddle.net/FrKyN/ Open the link and click to "Fork" (in the top menu) to get started.