OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: Re: [docbook-apps] webhelp javascript error


Thanks for that. I don't really want to modify the js, as that is going to create a divergence between the released version and my local version. Are there any plans to fix this?

Nat 


On Wed, Mar 19, 2014 at 8:20 PM, Kasun Gajasinghe <kasunbg@gmail.com> wrote:
I believe this is a bug. I was able to re-produce the error with the docbook sample you have provided. We have introduced following code segment [1] to main.js in order to fix an issue with the page-scroll-down when clicking on url anchors (the urls with #). 

The culprit is the jquery function, $('[name=' + this.hash.slice(1) +']'). In your case, this.hash.slice(1) return section4.id, but jquery fails to process it. 

One option you can do is to get rid of this code, and implement the alternative as suggested in [2].

[1]
        // When you click on a link to an anchor, scroll down 
        // 105 px to cope with the fact that the banner
        // hides the top 95px or so of the page.
        // This code deals with the problem when 
        // you click on a link within a page.
        $('a[href*=#]').click(function() {
                if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
                    && location.hostname == this.hostname) {
                    var $target = $(this.hash);
                    $target = $target.length && $target
                        || $('[name=' + this.hash.slice(1) +']');
                if (!(this.hash == "#searchDiv" || this.hash == "#treeDiv"  || this.hash == "") && $target.length) {
                        var targetOffset = $target.offset().top - 120;
                        $('html,body')
                            .animate({scrollTop: targetOffset}, 200);
                        return false;
                    }
                }
            });


[2] http://sourceforge.net/p/docbook/bugs/1219/




On Wed, Mar 19, 2014 at 11:00 AM, natk <nkershaw@gmail.com> wrote:
I have encountered the following _javascript_ error in webhelp:

Uncaught Error: Syntax error, unrecognized _expression_: [name=section4.id]

This only happens when I have a section which is four levels deep or more and I have given the section a manually generated id (i.e. it is a section to which I want to refer via an xref) which contains a dot(.) character.

The error occurs when I click on the section in question in the navigation sidebar.

My browser reports that the problem is in:

jquery-1.7.2.min.js:3

This is a docbook sample which demonstrates the problem:

<?xml version="1.0"?>
<book id="DocId" xmlns="http://docbook.org/ns/docbook">

  <title>Document Title</title>
  <chapter><title>Chapter</title>
    <section><title>Section Level 1</title>
      <section><title>Section Level 2</title>
        <section><title>Section Level 3</title>
          <section><title>Section Level 4</title>
          </section>
        </section>
      </section>

      <section id="section2.id"><title>Section Level 2 with ID</title>
        <section id="section3.id"><title>Section Level 3 with ID</title>
          <section id="section4.id"><title>Section Level 4 with ID</title>
            <para>And finally some text.</para>
          </section>
        </section>
      </section>

      <section id="section2id"><title>Section Level 2 with ID (no dot)</title>
        <section id="section3id"><title>Section Level 3 with ID (no dot)</title>
          <section id="section4id"><title>Section Level 4 with ID (no dot)</title>
            <para>And some more text.</para>
          </section>
        </section>
      </section>
    </section>
  </chapter>
</book>

It doesn't seem to like manually generated 'id's with the dot character in them.

Has anyone else found this? Is this a limitation of this format? Are there any other characters which are not permitted? Is it confusing the string literal for a regexp?

Nat 



--
~~~*******'''''''''''''*******~~~
Kasun Gajasinghe
Software Engineer; WSO2 Inc.; http://wso2.com,



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]