[OPEN-ILS-DEV] BibTemplate and Opera Compatibility

Mike Rylander mrylander at gmail.com
Tue Feb 15 14:01:00 EST 2011


On Mon, Feb 14, 2011 at 6:37 PM, Dan Wells <dbw2 at calvin.edu> wrote:
> Hello all,
>
> I spent some time recently trying to get some typical rdetail BibTemplate code to work in Opera, and made a few discoveries worth sharing.  The attached patch (against the rel_2_0 file, but with no path) is not at all complete code, and in particular the 'if (1)' lines are just placeholders for possibly some other condition should we decide to pursue this.
>
> From what I can tell, Opera gets tripped up by two independent aspects of BT.  First, it cannot properly respond to attributes in a dojo.query() call on JS XMLDocument objects (at least the ones EG delivers via unAPI).  That is, it will correctly do :
>
> dojo.query("datafield", bib);
>
> but fails on:
>
> dojo.query("datafield[tag=245]", bib);
>
> To get around this, we need to instead query the documentElement of the XMLDocument, not the XMLDocument itself.  Second, Opera does not work if the attribute is quoted within the query.  That is, it can correctly do :
>
> dojo.query("datafield[tag=245]", bib);
>
> but fails on:
>
> dojo.query("datafield[tag='245']", bib);
>
> or:
>
> dojo.query('datafield[tag="245"]', bib);
>
> The workaround here is to simply strip quotes from the query string before running it.
>
> In limited testing, these changes did not have negative side effects for rdetail display in other current browsers.  I also have not deciphered whether Opera is simply be more strict than the other browsers, or whether these are genuine Opera bugs.
>

There was a need to add quotes around literals in queries for one
browser or another (Dan Scott attacked this, IIRC), so how about
replacing the if(1)s with if(dojo.isOpera), at least for the second
hunk in the patch?  For the documentElement part, there is value in
having access to the document object from within slot code (maybe not
a huge amount, but IMO it's not worth removing if we can avoid it), so
perhaps we need a separate variable to hold that and use it in
internal queries.  Thoughts?

--miker

> Please report back if you are able to test this patch.  Also, do you think these changes cross the line between 'compatibility fix' and 'compatibility hack', and if so, are they worth considering for a minor browser?
>
> Thanks,
> Dan
>
> --
> *********************************************************************************
> Daniel Wells, Library Programmer Analyst dbw2 at calvin.edu
> Hekman Library at Calvin College
> 616.526.7133
>
>
>



-- 
Mike Rylander
 | VP, Research and Design
 | Equinox Software, Inc. / The Evergreen Experts
 | phone:  1-877-OPEN-ILS (673-6457)
 | email:  miker at esilibrary.com
 | web:  http://www.esilibrary.com


More information about the Open-ils-dev mailing list