[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-bugs-dist
Subject:    Bug#10450: main imagemap for www.nytimes.com is screwed up
From:       Lars Knoll <lars () trolltech ! com>
Date:       2000-09-14 8:47:42
[Download RAW message or body]

On Wed, 13 Sep 2000, Kurt Granroth wrote:
> pbrown@redhat.com wrote:
> > Package: konqueror
> > Version: 1.9.3b (KDE post 1.94 > 20000911)
> > Severity: normal
> >
> > the main imagemap for www.nytimes.com (on the left side, top link is
> > "Quick News" is screwed up.  All of the links that should take you
> > to subsections of the paper take you to the nytimes store.
>
> This is a tricky one.  First, this is a result of incorrect (broken)
> HTML.  According to the HTML4 spec, the coordinates of a map MUST be a
> comma separated list... and in fact, the second map on the nytimes
> page does do this.  Unfortunately, the first map doesn't.  It has
> things like:
>
> coords="0,0 9,16"
>
> Let's be clear -- this is invalid HTML.  In most cases, I would
> recommend closing this bug report and sending an email to the web
> admin to correct it.
>
> However, in this case, there are two mitigating circumstances:
>
> 1) The NYTimes website is a major one and they rarely listen to the
>    little guys.. and we do want Konqueror to support their website
> 2) IE and Netscape both support this broken HTML (which makes their
>    fixing it even more remote)
>
> So I looked into how we could fix this and it's not an easy one.  We
> do the conversion from a string to the coords in this function:
> DOMStringImpl::toLengthList.  It iterates on the comma to get the
> coords.  Quick fix: replace spaces by commas.
>
> Oops.. not that easy.  It's possible to have spaces in coordinates
> like so "25, 15" so this method does a str.replace(QRegExp(" "), "")
> stripping them out for parsing purposes.
>
> That means that our "0,0 9, 16" is reduced to "0,09,16"
>
> What to do?  We can't just convert spaces to commas since "25, 25"
> would become "25,,25".. which is wrong.
>
> Comments on how to proceed?

Use some QRegExp for the replacing ', ' with ',' and then proceed. Something 
like str.replace(QRegExp("\\, *"), ",") should do.

Lars

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic