G'day adambot,

In CSS, #identifier indicates a unique identifier which, in HTML, would be represented by an attribute that looks like id="identifier".

From http://www.w3.org/TR/css3-selectors/#id-selectors:

Document languages may contain attributes that are declared to be of type ID. What makes attributes of type ID special is that no two such attributes can have the same value in a conformant document, regardless of the type of the elements that carry them; whatever the document language, an ID typed attribute can be used to uniquely identify its element. In HTML all ID attributes are named "id"; XML applications may name ID attributes differently, but the same restriction applies.

I viewed the source of http://puzzledragonx.com/en/monster.asp?n=1645 and searched for 'tableprofile'. I stopped searching when I found a second id="tableprofile" (there might be more). Given that '#tableprofile' should be a unique identifier, but isn't, may be the root cause of your problem.

I'm not a user of Mojo::DOM; however, I see from its DESCRIPTION:

"... It will even try to interpret broken HTML ..."

Accordingly, you may be able to find a workaround by formulating a selector which does not include '#tableprofile'. Do note: that's just a guess on my part!

Furthermore, I'd be questioning any other supposedly unique identifiers in selectors provided by a browser. A simple search of the HTML source (as I did) is a quick and easy way to do this.

The full W3C specification is "Selectors Level 3" and is a fairly lengthy document. I rarely need to reference more than the "Summary Table of Selectors": there's plenty of links to more information if you need them.

— Ken


In reply to Re: CSS Selector in Perl by kcott
in thread CSS Selector in Perl by adambot

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.