473,387 Members | 1,582 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Node.prototype.removeChildren CANNOT WORK IN IE BUT FF?

I need to expand the DOM object function for conviniency as following:

Node.prototype.removeChildren = function() {
while( this.lastChild) this.removeChild( this.lastChild);
}

which can be accepted by Firefox but IE 6 doesnot !!!
Doesnot IE support prototype define above DOM object?
Sound Un-resonable!

Apr 6 '06 #1
7 6176
VK

zhong...@gmail.com wrote:
I need to expand the DOM object function for conviniency as following:

Node.prototype.removeChildren = function() {
while( this.lastChild) this.removeChild( this.lastChild);
}

which can be accepted by Firefox but IE 6 doesnot !!!
Doesnot IE support prototype define above DOM object?
Sound Un-resonable!


Sounds very resonable to me because JavaScript != DOM and JavaScript
native methods != host objects methods.

Mozilla was able to implement this highly questionnable mixture because
their entire browser is implemented on JavaScript, including interface.
So it was not so difficult to add several extra bridges between the
engine and DOM tree.

A "highly questionnable mixture" because it seems confuse hell out of
developers as they missing the important difference between JavaScript
and DOM (based on posts in this group). So far no one tried yet to make
floating point math on say SPAN, but it may be just over the corner :-)

The proper way to achieve what you are looking for is behavior (binding
by Mozilla).

You may start from here:
<http://msdn.microsoft.com/workshop/author/behaviors/overview.asp>
<http://www.mozilla.org/projects/xbl/xbl.html>

Apr 6 '06 #2
VK wrote:
zhong...@gmail.com wrote:
I need to expand the DOM object function for conviniency as following:

Node.prototype.removeChildren = function() {
while( this.lastChild) this.removeChild( this.lastChild);
}

which can be accepted by Firefox but IE 6 doesnot !!!
Doesnot IE support prototype define above DOM object?
Sound Un-resonable!
Sounds very resonable to me because JavaScript != DOM and JavaScript
native methods != host objects methods.


The explanation is correct, but it is not an explanation for this problem
at all.
Mozilla was able to implement this highly questionnable mixture because
their entire browser is implemented on JavaScript, including interface.
So it was not so difficult to add several extra bridges between the
engine and DOM tree.
Utter nonsense, as usual. Could you just hold your fingers still when you
have nothing intelligent to post? It would save a great deal of precious
bandwidth. TIA.

It works in Firefox because the Gecko DOM implements the Node interface
of the W3C DOM as a prototyped host object. That is not a questionable
design decision at all.
A "highly questionnable mixture" because it seems confuse hell out of ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ developers as they missing the important difference between JavaScript
and DOM (based on posts in this group).


(You call it that because your puny mind still cannot comprehend that
difference? I see.)

It does not work in IE yet because the IE DOM does no such thing yet.

The relevance of this fact regarding the fact that Gecko-based UAs implement
JavaScript (originally Netscape's, now Mozilla.org's ECMAScript
implementation) and IE-based UAs implement JScript (Microsoft's
ECMAScript implementation) as scripting language, equals _zero_.
PointedEars
Apr 6 '06 #3

Thomas 'PointedEars' Lahn 写道:
VK wrote:
zhong...@gmail.com wrote:
I need to expand the DOM object function for conviniency as following:

Node.prototype.removeChildren = function() {
while( this.lastChild) this.removeChild( this.lastChild);
}

which can be accepted by Firefox but IE 6 doesnot !!!
Doesnot IE support prototype define above DOM object?
Sound Un-resonable!
Sounds very resonable to me because JavaScript != DOM and JavaScript
native methods != host objects methods.


The explanation is correct, but it is not an explanation for this problem
at all.
Mozilla was able to implement this highly questionnable mixture because
their entire browser is implemented on JavaScript, including interface.
So it was not so difficult to add several extra bridges between the
engine and DOM tree.


Utter nonsense, as usual. Could you just hold your fingers still when you
have nothing intelligent to post? It would save a great deal of precious
bandwidth. TIA.

It works in Firefox because the Gecko DOM implements the Node interface
of the W3C DOM as a prototyped host object. That is not a questionable
design decision at all.
A "highly questionnable mixture" because it seems confuse hell out of

^^^^^^^^^^^^^^^^^^^^^^^^^^^^
developers as they missing the important difference between JavaScript
and DOM (based on posts in this group).


(You call it that because your puny mind still cannot comprehend that
difference? I see.)

It does not work in IE yet because the IE DOM does no such thing yet.

The relevance of this fact regarding the fact that Gecko-based UAs implement
JavaScript (originally Netscape's, now Mozilla.org's ECMAScript
implementation) and IE-based UAs implement JScript (Microsoft's
ECMAScript implementation) as scripting language, equals _zero_.


Then, how to expand the DOM object function for IE instead of prototype
approach?
Is there anyway, such as encapsulating or something else, to implement
it?
Or no way at all?! If so, really bad :(


PointedEars


Apr 7 '06 #4
OK, thanks all answering to this question.

I have check this newgroup by searching with "dom prototype".
It cannot work out with IE DOM object of bingding prototype on it.

Apr 7 '06 #5
Zif
zh******@gmail.com wrote:
...IE DOM object of bingding prototype...

^^^^^^^^
^^^^^^^^
That's gotta be a Freudian slip!
--
Zif
Apr 7 '06 #6
VK

zh******@gmail.com wrote:
I have check this newgroup by searching with "dom prototype".
It cannot work out with IE DOM object of bingding prototype on it.


You cannot make say "all HTML elements in this document have foobar()
method" in one assignment. But you can make say all div's in your
document draggable - in one assignment:

<style type="text/css"">
div {
behavior: url(draggable.htc);
/* for the exact link see MSDN link I gave you */
}
</style>

Pair with -moz-binding and you are done. Same way you can make say all
<address> block play music on click by default.

The medieval way is presented in two flawors:
The one you already know: create your own JavaScript objects with DOM
reference in it.

Another one is overload the constructor, so it would return the DOM
reference back after augmentation:

function xDIV(div) {
div.$ = this;
this.method1 = ...
this.method2 = ...
return div;
}
....
var d = document.createElement('DIV');
document.body.appendChild(new xDIV(d));

But it is indeed a medieval alchimie requiring manual node traversal
plus all neeeded and not needed code in one chunk.

As both bindings and behaviors are written in the conventiona
JavaScript/JScript I see no problem to use the recommended way.

Apr 7 '06 #7
zh******@gmail.com wrote:
I need to expand the DOM object function for conviniency
as following:

Node.prototype.removeChildren = function() {
while( this.lastChild) this.removeChild( this.lastChild);
}

which can be accepted by Firefox but IE 6 doesnot !!!
Doesnot IE support prototype define above DOM object?
Sound Un-resonable!


This would only sound unreasonable if you had good reasons to expect to
be able to modify the prototypes of host objects, which you don't, and
you could not trivially achieve the same outcome by some other means.

If you want to strip all the children from an element why not write a
global function for the task and pass the element as an argument to that
function?

function removeElementChildren(element){
var node;
while((node = element.lastChild)){
element.removeChild(node);
}
}

Richard.
Apr 7 '06 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: ELF | last post by:
cannot using onAfterPrint in IE 6.0, the page can print but cannot close. Why?? my code like as below <body onAfterPrint="window.close();"> : <script language="javascript"...
4
by: Jonathan Dodds | last post by:
I have two files in an ASP project I created with VI 6.0: circle.inc and default.asp. circle.inc: // circle.inc function Circle (xPoint, yPoint, radius) { this.x = xPoint; // The x...
0
by: acharyaks | last post by:
Hi life saver, I am using excel component for the development. The purpose is to connect to excel through the odbc connection string. Then through the connection extract data into a dataset and...
4
by: Charts | last post by:
6/23/05 ..NET Development\Framework\dotnet.framework.aspnet Visual Studio 2005 Beta 2 project cannot work in IIS virtual directory I used Visual Studio 2005 Beta 2 to build a simple new...
6
by: ABC | last post by:
I write the code as: <asp:LinkButton ID="LinkButton2" Text='<%# Eval("Title") %>' PostBackUrl='file://<%# Eval("path") %>' runat="server"></asp:LinkButton> But It don't work to download or open...
0
by: Laurence | last post by:
Hi there, I cannot use "setup /i xx" to install DB2 Client (v9fp2_win_client.zip) on Win XP SP2. The installation process was stopped at the page "Select the languages to install". But use...
1
by: web20tester | last post by:
Hi all, I am new to javascript. I have this script working fine in IE but cannot work in firefox. Really appreciate on any guidance. search0.js function Search(str) { var...
1
by: SunshineInTheRain | last post by:
I have 2 servers, server1(window server 2003) and server2(window server 2000). The LogonUser work on server1 but show error code 1326 (which mean bad userName or Password) on server2 with both same...
12
by: GuangXiN | last post by:
I want the file upload element disappear, instead of it, I place a text box and a button with my own css defination. but it doesn't work on IE7. What should I do now? <form action="upload.php"...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.