By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,379 Members | 1,396 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,379 IT Pros & Developers. It's quick & easy.

KHTML/Safari, Javascript, and DOM classes

P: n/a
Hello,

Does anyone know if KHTML/Safari just doesn't support code such
as:

----------
HTMLInputElement.prototype.toggle = function(enabled) {
//some really spiffy code
}
----------

I've got some code that works in Moz and follows good design etc., but
Safari ignores it, and Konq tells me that it's barfing on the
HTMLInputElement.prototype stuff.

Any ideas?

-Felipe Gasper
Urbana, IL, USA
Jul 20 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Felipe Gasper wrote:
<snip>
I've got some code that works in Moz and follows good
design etc., but Safari ignores it, and Konq tells me
that it's barfing on the HTMLInputElement.prototype stuff.

<snip>

As far as I am aware Mozilla/Gecko is the only type of browsers that
exposes prototypes for the DOM Nodes to javascript. Which is to be
expected as they are host objects and ECMA 262 makes no requirement that
host objects exhibit any specific behaviour.

In addition - HTMLInputElement - is defined by the W3C HTML DOM as an
interface so it is only an implementation decision that there would be a
corresponding "class" that could be prototyped available in the system.
The DOM Nodes on Opera 7, for example, claim that their constructor is -
function Object() { [native code] } - which would imply that Opera is
implementing W3C DOM interfaces by augmenting objects rather than by
inheritance (prototype-based or otherwise), and there is no particular
reason why they shouldn't.

Richard.
Jul 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.