Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #29790

Re: Searching the visual appearance of a Web page?

From Dr J R Stockton <reply1600@merlyn.demon.co.uk.invalid>
Newsgroups comp.lang.javascript
Subject Re: Searching the visual appearance of a Web page?
Date 2016-03-03 23:25 +0000
Organization Home
Message-ID <78AX6LG2fM2WFw29@invalid.uk.co.demon.merlyn.invalid> (permalink)
References <wW01wWroDN1WFw8z@invalid.uk.co.demon.merlyn.invalid> <nb3rgk$ial$1@news.albasani.net>

Show all headers | View raw


In comp.lang.javascript message <nb3rgk$ial$1@news.albasani.net>, Tue, 1
Mar 2016 11:39:17, Martin Honnen <mahotrash@yahoo.de> posted:

>Dr J R Stockton wrote:
>> I have a reference to the body element of a local Web page, and can
>> assume that body.onload() has finished.  I also have a RegExp, which has
>> been defined from the value of an input type=text element.
>>
>> I want to apply that RegExp to the whole displayed text, all at once or
>> piecemeal, and get all of the matches.  I have been using the match
>> method on body.innerText, body.innerHTML, or body.textContent, which was
>> good enough to do what I wanted, but not ideal.
>>
>> For example, the text up<br>on in the HTML source must be treated as the
>> two words "up on" and not the one word "upon".  And, if practical,
>> "c&acirc;m" should be treated as a three-letter word.
>
>innerText should give you a plain string in which e.g. <br> has been
>converted to a new line character and a character reference to its
>character. The only drawback is that Firefox in its current version 44
>does not support it, but according to http://perfectionkills.com/the-
>poor-misunderstood-innerText/ in Firefox 45 we will see support. So
>doing the regular expression search on body.innerText seems like the
>most promising approach. Or why did "innerText" not give you the ideal
>result, unless you needed it with Mozilla browsers?

I habitually use the most recent ordinary release of Firefox - Firefox
has "Zoom Text Only" which I consider essential.

I'm using WinXP sp3, and reading files into an iframe, directly from the
disc without any server, WinXP sp3.  Early Chrome was OK, but Chrome 4.0
& later does not do that, it misapplies "Same domain Policy".  Something
fails in Opera 35, with a decent error message; but Opera 12.18 is OK.
IE8 is OK.  Vivaldi gives a message like Opera 35, then falls over dead.

I get the content of the page variously with textContent, innerText, and
innerHTML - and should review those after Firefox 45 appears.

So, as Firefox 45 is due out on Tuesday ...

One use is to search for candidate acronyms for listing across a web
site master - upper-case words of  sensible length.  I should be able to
arrange to maintain a list of acronyms already known (e.g. NATO) and
non-acronyms that look like that (e.g. KABOOM), and then report only the
ones not listed there ...

For amusement - a few years ago, Firefox and Opera would not load page
X.HTM into an IFRAME in page X.HTM, but others would.  The workround, to
read itself rather than a copy of itself, is still in place, and I
wonder whether it is now needed in none, some, or any of the current
browsers.

Thanks.

> ...

-- 
 (c) John Stockton, Surrey, UK.  ¬@merlyn.demon.co.uk   Turnpike v6.05   MIME.
 Merlyn Web Site <                       > - FAQish topics, acronyms, & links.

Back to comp.lang.javascript | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Searching the visual appearance of a Web page? Dr J R Stockton <reply1600@merlyn.demon.co.uk.invalid> - 2016-02-29 23:14 +0000
  Re: Searching the visual appearance of a Web page? Martin Honnen <mahotrash@yahoo.de> - 2016-03-01 11:39 +0100
    Re: Searching the visual appearance of a Web page? Dr J R Stockton <reply1600@merlyn.demon.co.uk.invalid> - 2016-03-03 23:25 +0000
      Re: Searching the visual appearance of a Web page? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-03-03 16:27 -0800
        Re: Searching the visual appearance of a Web page? Dr J R Stockton <reply1600@merlyn.demon.co.uk.invalid> - 2016-03-05 23:37 +0000
  Re: Searching the visual appearance of a Web page? Bart Van der Donck <bart@nijlen.com> - 2016-03-02 00:49 -0800

csiph-web