Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #14978
| Path | csiph.com!usenet.pasdenom.info!news.albasani.net!news.mixmin.net!npeer.de.kpn-eurorings.net!npeer-ng0.de.kpn-eurorings.net!newsfeed.arcor.de!newsspool3.arcor-online.net!news.arcor.de.POSTED!not-for-mail |
|---|---|
| Content-Type | text/plain; charset="UTF-8" |
| Message-ID | <2146299.mvXUDI8C0e@PointedEars.de> (permalink) |
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
| Reply-To | Thomas 'PointedEars' Lahn <cljs@PointedEars.de> |
| Organization | PointedEars Software (PES) |
| Date | Mon, 09 Jul 2012 22:09:40 +0200 |
| User-Agent | KNode/4.4.11 |
| Content-Transfer-Encoding | 8Bit |
| X-Face | %i>XG-yXR'\"2P/C_aO%~;2o~?g0pPKmbOw^=NT`tprDEf++D.m7"}HW6.#=U:?2GGctkL,f89@H46O$ASoW&?s}.k+&.<b';Md8`dH6iqhT)6C^.Px|[=M@7=Ik[_w<%n1Up"LPQNu2m8|L!/3iby{-]A+#YE}Kl{Cw$\U!kD%K}\2jz"QQP6Uqr],./"?;=4v |
| Face | iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAGFBMVEXTxa4RFk5dUWANED8PFEfy7+MGBiW+n3ZNF/QuAAACaElEQVQ4jVXUwVOcMBQG8Dc7Rc4PUntdWV2uxjDpGaGeozOp1woar4jd5t/v9wLstMwsA/ntlxdCAgUc1hjTc9/JCZfGoo3wG3HdmdAWrIJRHe7GM/TmpY5VFefuVcAkkPbLIaN8rmPmjloyZxgyR3GuJ4K0AGtJ2htz8o7yqikm759fldQXaMpbDzjKAG+8v+AugVTOPO5DOjLvGtUYQwh0CPjnVMyGd+8/GfUB5nLKJDD2aLDh5HYyMDJGDwQIo2ZmZcKbowNmAdB/AzyFhrmF2MHRb0QJJfaAnwGB6orZhoykLzJtGwF/xpYxI1dswomiUj3gTuAIqCn/4C7cULwGNBtwMTk3Y4LfKB5YUaOKBKYtpplm7u0vip8tU1NWWyI/7XdcSuIDoMt6rVHMWT0DbjHPGqDqZVSa6zleLcUTcIKLoMv3ueJluALtAo9B302zPPlrtiVScRdCjXvVh3e3JpYa/jjkuC9N+LrBMlz/eAN4eQijX2EdLo6c5tGGHwLyHFtXk89dDGHwCVhG9T0S/j55AhRZgkMCmUQXJ49TnS1wnQDvw0eAh9ICeMmEFbCnPMFzjAvsWoEWEFdYEx+S0MoUZ1gT1wId8+AF3Bl2OoEu906AUHx5VLw/gXYg/x84loOah/2UYNrgiwSwGO7RfUzVBbx/kgpckumGOi6QirtD6gkLTitbnxNol47S2jVc2vsN5kPqaAHT8uUdAJM4v/DanjYOwmUjWznGfwB7sGtAtor5BgofDuzaRj4kSQAqDakTsKORa3Q3xKi3gE1fhl71KRMqrdZ2AWNNg/YOhQyrVBnb+i+nEg4bsDA+egAAAABJRU5ErkJggg== |
| Subject | Re: Built-in string functions clobber strings in array? |
| Newsgroups | comp.lang.javascript |
| References | <2c985566-9108-4346-873c-a709466fa795@googlegroups.com> <jte575$u4f$1@dont-email.me> |
| Followup-To | comp.lang.javascript |
| MIME-Version | 1.0 |
| Lines | 39 |
| NNTP-Posting-Date | 09 Jul 2012 22:09:41 CEST |
| NNTP-Posting-Host | 48659b01.newsspool3.arcor-online.net |
| X-Trace | DXC=DGkSm`W>aLC@k=MdN::NBIMcF=Q^Z^V3H4Fo<]lROoRA8kF<OcfhCOKe1h`^Sj[7oNDZm8W4\YJNLR=i2=[N6Y6J2Bg2=5`][4NCYlm?JV62`@ |
| X-Complaints-To | usenet-abuse@arcor.de |
| Xref | csiph.com comp.lang.javascript:14978 |
Followups directed to: comp.lang.javascript
Show key headers only | View raw
Gregor Kofler wrote:
> Am 2012-07-09 05:01, terphenyl meinte:
>> var allLinks = content.document.getElementsByTagName("a");
>> […]
>>
>> I thought the elements of allLinks were strings
>
> allLLinks is a collection of DOM elements.
It refers to a NodeList of references to DOM element objects, which in the
Gecko DOM also implements the HTMLCollection interface (for reasons I do not
understand).
> , and, to be conservative
>> copied the strings to a different variable (txt) and then tried a string
>> operation (or two) on that variable.
>
> An internal toString() method is invoked (which - here in FF - gives you
> the href attribute value of the anchor). However, they are not strings
> and don't provide string methods. Try something like allLinks[jj].href
> which holds a string.
Caveat: The value of the `href' property, and the return value of the
toString() method, might not reflect the value of the `href' attribute; in
fact, it may represent the (absolute) URI for a given (relative) URI-
reference (see RFC 3986). In order to be sure about the value, you would
need to use getAttribute("href"), but there is IE/MSHTML.
Therefore, ISTM that you need to strip the protocol, host, and path part of
the current document from the property value before you attempt a match.
PointedEars
--
Anyone who slaps a 'this page is best viewed with Browser X' label on
a Web page appears to be yearning for the bad old days, before the Web,
when you had very little chance of reading a document written on another
computer, another word processor, or another network. -- Tim Berners-Lee
Back to comp.lang.javascript | Previous | Next — Previous in thread | Find similar | Unroll thread
Built-in string functions clobber strings in array? terphenyl <terphenyl@hotmail.com> - 2012-07-08 20:01 -0700
Re: Built-in string functions clobber strings in array? Gregor Kofler <usenet@gregorkofler.com> - 2012-07-09 10:36 +0200
Re: Built-in string functions clobber strings in array? terphenyl@hotmail.com - 2012-07-09 12:39 -0700
Re: Built-in string functions clobber strings in array? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-07-09 22:09 +0200
csiph-web