Bug Tracker

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#13866 closed bug (wontfix)

$.fn.css should work (not crash) on the document

Reported by: jbedard Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.9.1
Keywords: Cc:
Blocked by: Blocking:

Description

Since 13832 won't be fixed I think all standard jQuery methods should work on the document. The only one I've found which doesn't is $.css: $("html").parent().css("color") crashes.

It seems like it doesn't always crash though, after doing $("html").css("color") once $("html").parent().css("color") starts working (returning undefined) in chrome/IE8. Firefox seem to always crash and has a different error then chrome.

Change History (2)

comment:1 Changed 7 years ago by timmywil

Resolution: wontfix
Status: newclosed

This seems like overkill. There are valid use cases for allowing .parent() to return a document, but doesn't mean we need to fail silently when trying to set styles on a non-element. In fact, an exception may even be preferred in that case because the user needs to know that it's pointless to try to set that.

comment:2 Changed 7 years ago by jbedard

This is fetching styles, not setting them. Even if it throws it would be nice if it was consistent, even within a single browser it is not consistent right now. This might just mean adding a null check, I don't see how that is overkill..?

Note: See TracTickets for help on using tickets.