Bug Tracker

Opened 11 years ago

Closed 10 years ago

Last modified 8 years ago

#4018 closed bug (fixed)

documentation incorrect for jQuery.support.tbody

Reported by: timc Owned by:
Priority: minor Milestone: 1.3.2
Component: docs Version: 1.3.1
Keywords: support Cc:
Blocked by: Blocking:

Description

currently at http://docs.jquery.com/Utilities/jQuery.support it says:

# tbody: Is equal to true if the browser allows table elements without tbody elements (is currently false in IE, which automatically inserts tbody if it is not present).

However, that seems backwards -- on my ff3.0

$.support.tbody

true

thanks

Change History (7)

comment:1 Changed 11 years ago by dmethvin

What makes you think that $.support.tbody==true is incorrect for Firefox 3.0?

comment:2 Changed 11 years ago by timc

the behavior is correct, but i think documentation is incorrect or at least confusing:

# tbody: Is equal to true if the browser allows table elements without tbody elements (is currently false in IE, which automatically inserts tbody if it is not present).

ff does not "allow" table elts w/o tbody in the sense that $('table > tr') will not return a result; it is ff that "automatically inserts tbody" -- i don't believe IE does, although i have not checked on all IE versions.

Thanks!

comment:3 Changed 11 years ago by dmethvin

Ah, okay. IE does indeed insert tbody tags in several cases where most other browsers do not. For example, take an HTML document with <table></table> in it and get the resulting .innerHTML to see what I mean.

jQuery needs to know this so that when it handles $("htmlstring") cases, it can fix cases where IE goes all tbody-happy on the resulting DOM. This is actually a pretty obscure thing and I doubt that any code outside jQuery itself would need to use the feature detection, so it's probably not too critical to explain it in a lot of detail.

comment:4 Changed 10 years ago by dmethvin

Resolution: fixed
Status: newclosed

Updated documentation for jQuery.support to clarify this.

comment:5 Changed 10 years ago by mcm

Resolution: fixed
Status: closedreopened

I still found the documentation on $.support.tbody very confusing until I found this, can:

"Is equal to true if a <table> element can exist without a <tbody> element"

Be changed to something like:

"Is equal to true if an empty <table> tag can exist without a <tbody> element"

comment:6 Changed 10 years ago by mcm

Just to clarify, now that I know what this property represents it's not of use to me as you suggested. In my script I needed to account for the presence of the tbody element (i.e. <table><tr></tr></table>) and wasn't sure if all browsers inserted it in this case or not so used some javascript to test it in case. However, I later found this property in the docs and thought I could tidy up my code a bit by using it instead but found it was wrong.

So hopefully by changing the docs to allude to one of the situations where non-IE browsers don't insert tbody I would have tested this and then realised this property doesn't apply to me.

comment:7 Changed 10 years ago by dmethvin

Resolution: fixed
Status: reopenedclosed
Note: See TracTickets for help on using tickets.