473,405 Members | 2,160 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,405 software developers and data experts.

swapNode() under Mozilla issue...

hi all,

if that can help somebody....

feedback welcome

<html>
<head>

<style type="text/css">
blockquote{ border:1px solid red;margin:15px;padding:2px;}
div{border:1px solid blue; margin:2px; padding:2px;}

</style>

<script language="javascript" >
if(self.Node) {
Node.prototype.swapNode = function(n){
var p = n.parentNode;
var s = n.nextSibling;
this.parentNode.replaceChild(n,this);
p.insertBefore(this,s);
return this;
}
}

function is_all_ws( nod )
{
// Use ECMA-262 Edition 3 String and RegExp features
return !(/[^\t\n\r ]/.test(nod.data));
}

function is_ignorable( nod ){
return ( nod.nodeType == 8) || // A comment node
( (nod.nodeType == 3) && is_all_ws(nod) ); // a text node, all ws
}

function node_before( sib ){
while ((sib = sib.previousSibling)) {
if (!is_ignorable(sib))
return sib;
}
return null;
}

function node_after( sib ){
while ((sib = sib.nextSibling)) {
if (!is_ignorable(sib))
return sib;
}
return null;
}

function move( obj, direction ){
while( obj.nodeName != "BLOCKQUOTE" )
obj = obj.parentNode;

if( direction == 1 && obj != obj.parentNode.lastChild ){
var cur = obj;
while (cur){
if (cur.nodeName == "BLOCKQUOTE"){
obj.swapNode( cur )
}
cur = node_after(cur);
}
}

if( direction == -1 && obj != obj.parentNode.firstChild ){
var cur = obj;
while (cur){
if (cur.nodeName == "BLOCKQUOTE"){
obj.swapNode( cur )
}
cur = node_before(cur);
}
}
}
</script>
</head>
<body>
<div id="root">
<blockquote>
<a href="javascript:void(0)" onclick="move(this, -1)">up</a>
<a href="javascript:void(0)" onclick="move(this, 1)">down</a>
<input type="text" name="field" value="1">
</blockquote>
<blockquote>
<a href="javascript:void(0)" onclick="move(this, -1)">up</a>
<a href="javascript:void(0)" onclick="move(this, 1)">down</a>
<input type="text" name="field" value="2">
</blockquote>

</div>
</body>

</html>
Jul 23 '05 #1
1 2746
On 29 Jul 2004 03:56:31 -0700, poofpoof <po******@free.fr> wrote:
hi all,

if that can help somebody....


Help with what? You've presented code and implied that there is an "issue"
with Mozilla, but failed to describe it. As far as I can tell, there's
nothing wrong, other than some undesirable padding due to the whitespace
between block elements. You could get rid of that either by formatting the
HTML to include no whitespace between the DIV and BLOCKQUOTE elements.
Alternatively, you could use the DOM to delete the corresponding text
nodes.

Is this a request for help, or a solution?

Mike

[snipped code]
Jul 23 '05 #2

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

Similar topics

1
by: nick | last post by:
I found that the width attribute in Mozilla is different in IE. In Mozilla, if the content in dropdownlist's list or table <td> cell is wider than the width attribute, Mozilla just enlarge the...
35
by: Richard | last post by:
I finally got Mozilla installed and running just last week and wow... Nice work you Mozilla developers, you! And is it just me or does Mozilla really interpret/execute CSS code really well...
9
by: Roberto | last post by:
Hi everyone, I'm new here... I have a frameset header/contents. It's necessary to force the header's scrollbar to be visible to preserve the alignment between the two frames (see...
3
by: kj | last post by:
This problem is driving me nuts. The code at the end of this post below works fine with IE, but fails with Mozilla. You can see it in action at http://tinyurl.com/2jvo3 With Mozilla 1.4 and...
8
by: Nicolás Lichtmaier | last post by:
Hi, some time ago I've written an article about this issue. It explain some differences in Explorer's and Mozilla's JavaScript/DOM. It has recently changed its URL, This is the new one: ...
6
by: Thomas | last post by:
In Mozilla: The problem we are trying to solve: We are using XSL/XML to generate tables with text in the rows. The spacing is wider then when those same exact tables are created in regular HTML....
7
by: signo | last post by:
Hello to everybody, I'm trying to make a link that closes the browser: <a href="javascript:window.close()">CLOSE</a> It works with IE6 but not with Mozilla and Netscape. Does anybody knows...
3
by: teo | last post by:
Mozilla error on postback and validation ----------- A Button causes a Listbox to desappear. If no item has been selected on the Listbox, all is OK. If one or more items are selected,
4
by: R144N | last post by:
Hi Everyone, I've searched variuos forums as much as I could for a similar problem within the time I could and found no helpful solution, I hope someone here can help me out: I have an iFrame...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.