469,336 Members | 5,643 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,336 developers. It's quick & easy.

KHTML/Safari, Javascript, and DOM classes

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 23 '05 #1
1 1141
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 23 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Felipe Gasper | last post: by
5 posts views Thread by joaopedrogoncalves | last post: by
8 posts views Thread by Giuseppe Chielli | last post: by
2 posts views Thread by laredotornado | last post: by
34 posts views Thread by Simon Wigzell | last post: by
7 posts views Thread by Tom | last post: by
3 posts views Thread by MikeK | last post: by
15 posts views Thread by GinnTech | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.