![]() ![]() |
in some of my scripts I'm using the ability of firefox to handle with multiple text ranges, but for a unknown reason multiple ranges are not possible in most sites I have tested.
For example, If I try to select multiple text ranges of my post, the parent object is selected. But If I try the same in any google search, then it works as expected. The site Mozilla Developer Center (MDC) is another example that it works well. I'll update this post with a screenshot to make it clear. [DONE] My question is: is there something that allow us to decide whether to enable/disable multiple selection in specific sites ?Ps: Hold the Ctrl button to select multiple ranges
|
![]() ![]() |
Hmm, that is odd behaviour. It seems to be built into Firefox. I tried disabling CSS, Javascript and all Add-ons but this did not change the behaviour. It appears that it only does this with text that is inside of a html table. Edit: Yeah it is a bug in Firefox https://bugzilla.mozilla.org/show_bug.cgi?id=30... |
![]() ![]() |
You are right! It has something to do with the table cells as seen below ![]() Hopefully I'll find a workaround for this |
![]() ![]() |
I'd be interested in how you worked around this? I would replace the table with divs using css to mimic a table. However there is probably a better way. |
![]() ![]() |
I tried this and no success var tds = document.evaluate("//td", document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
for ( var ai = tds.snapshotLength ; ai-- ; )
{
var td = tds.snapshotItem(ai);
var div = document.createElement("div");
while (td.firstChild)
div.appendChild(td.firstChild);
td.appendChild(div);
}
|
![]() ![]() |
wesley, you forgot to subtract 1, but why not just use the simpler approach: var tds = document.getElementsByTagName("td");
for ( var i = tds.snapshotLength - 1; i >= 0; --i)
{
var td = tds[i], div = document.createElement("div");
while (td.firstChild) div.appendChild(td.firstChild);
td.appendChild(div);
}
do you have to remove the node before attaching it btw? ... while (td.firstChild) div.appendChild(td.parentNode.removeChild(td.firstChild)); ... |


