title: Why doesn't this user script work in Opera?
body: <p>This is my userscript: </p>
  
  <pre><code>// ==UserScript==
  // @name           wykopSpamBlock
  // @namespace      wykopSpamBlock
  // @description    Skrypt ukrywający sponsorowane i polecane wykopy w serwisie wykop.pl 3.0
  // @include        http://www.*wykop.pl/
  // @include        http://www.*wykop.pl/strona/*
  // @include        http://www.*wykop.pl/wykopalisko*
  // @include        http://www.*wykop.pl/hity* 
  // ==/UserScript==
  
  (function() {
  
    function block(element) {
  
      element.style.display = 'none';
      console.log('It works');
  
    }
  
    //////////////////////////////////////////////////////////////////////
  
    var Filter = new RegExp('^http://www.wykop.pl/link/partnerredirect/');
    var Entries = document.getElementById('body-con').getElementsByClassName('entry');
    var Links;
  
    //////////////////////////////////////////////////////////////////////
  
    for (i = 0; i &lt; Entries.length; i++) {
  
      Links = Entries.item(i).getElementsByTagName('div').item(0).getElementsByClassName('content').item(0).getElementsByTagName('header').item(0).getElementsByTagName('p').item(0).getElementsByTagName('a');
  
      if (Filter.test(Links.item(1).href) || Filter.test(Links.item(2).href)) {
        block(Entries.item(i));
      }
  
    }
  
  })();
  </code></pre>
  
  <p>It works fine in Chrome and Firefox (GreaseMonkey), but it doesn't in Opera. I get this error:</p>
  
  <pre><code>User Javascript thread
  Uncaught exception: TypeError: Cannot convert 'Entries.item(i).getElementsByTagName('div').item(0).getElementsByClassName('content').item(0)' to object
  Error thrown at line 30, column 4 in &lt;anonymous function&gt;():
      Links = Entries.item(i).getElementsByTagName('div').item(0).getElementsByClassName('content').item(0).getElementsByTagName('header').item(0).getElementsByTagName('p').item(0).getElementsByTagName('a');
  called from line 11, column 0 in program code:
      (function() {
  </code></pre>
  
  <p>And the question is, what's wrong?</p>
  
  <p>//edit</p>
  
  <p>For people who can't read that:</p>
  
  <pre><code>// ==UserScript==
  // @name           wykopSpamBlock
  // @namespace      wykopSpamBlock
  // @description    Skrypt ukrywający sponsorowane i polecane wykopy w serwisie wykop.pl 3.0
  // @include        http://www.*wykop.pl/
  // @include        http://www.*wykop.pl/strona/*
  // @include        http://www.*wykop.pl/wykopalisko*
  // @include        http://www.*wykop.pl/hity* 
  // ==/UserScript==
  
  (function() {
  
    function block(element) {
  
      element.style.display = 'none';
      console.log('It works');
  
    }
  
    //////////////////////////////////////////////////////////////////////
  
    var Filter = new RegExp('^http://www.wykop.pl/link/partnerredirect/');
    var Entries = document.getElementById('body-con').getElementsByClassName('entry');
  
    //////////////////////////////////////////////////////////////////////
  
    for (i = 0; i &lt; Entries.length; i++) {
  
      var EntriesItem = Entries.item(i);
      var Div = EntriesItem.getElementsByTagName('div');
      var DivItem = Div.item(0);
      var Content = DivItem.getElementsByClassName('content');
      var ContentItem = Content.item(0);
      var Header = ContentItem.getElementsByTagName('header');
      var HeaderItem = Header.item(0);
      var Paragraph = HeaderItem.getElementsByTagName('p');
      var ParagraphItem = Paragraph.item(0);
      var Links = ParagraphItem.getElementsByTagName('a');
  
      if (Filter.test(Links.item(1).href) || Filter.test(Links.item(2).href)) {
        block(Entries.item(i));
      }
  
    }
  
  })();
  </code></pre>
  
  <p>and error:</p>
  
  <pre><code>[26.09.2011 20:35:07] JavaScript - http://www.wykop.pl/
  User Javascript thread
  Uncaught exception: TypeError: Cannot convert 'ContentItem' to object
  Error thrown at line 35, column 4 in &lt;anonymous function&gt;():
      var Header = ContentItem.getElementsByTagName('header');
  called from line 11, column 0 in program code:
      (function() {
  </code></pre>
  
  <p>//edit 2</p>
  
  <p>Here is full html of entry. Content starts in 21 line.</p>
  
  <pre><code>&lt;article class="entry brbotte8 pding15_0  {id:891309}"&gt;
    &lt;div class="clr rel"&gt;
  
      &lt;div class="fleft diggbox"&gt;
        &lt;a href="http://www.wykop.pl/link/dig/%7E2/891309/55a55552de3fac6ececb6a8933938e71-1317062985/log_ref_0,index,log_ref_m_0,index,log_ref_n_0," class="block tcenter tdnone diggit "&gt;
          &lt;span class="icon inlblk diggcount cff5917 large fbold vtop animated "&gt;
            22
          &lt;/span&gt;
          &lt;span class="block action small br3 bre3"&gt;
            wykop
          &lt;/span&gt;
        &lt;/a&gt;
      &lt;/div&gt;
  
      &lt;a href="http://www.wykop.pl/ramka/891309/policjant-strzelil-nastolatkowi-w-twarz-taserem-wideo/" class="image  rel fright"&gt;
        &lt;div class="lazy"&gt;
          &lt;!--&lt;img src="http://c0692282.3.cdn.imgwykop.pl/hi_34VehOZEwdnDXdwlMEBOWbkmNGIzrPM0.jpg" alt="Policjant strzelił nastolatkowi w twarz taserem [wideo" class="fright border marginleft15" width="104" height="74" /&gt;--&gt;
        &lt;/div&gt;
      &lt;/a&gt;
  
      &lt;div class="content"&gt;
  
        &lt;header&gt;
          &lt;h2 class="xx-large lheight20"&gt;
            &lt;a href="http://www.wykop.pl/ramka/891309/policjant-strzelil-nastolatkowi-w-twarz-taserem-wideo/"  class="link"&gt;
              &lt;span class="fbold"&gt;Policjant strzelił nastolatkowi w twarz taserem [wideo&lt;/span&gt;
            &lt;/a&gt;
          &lt;/h2&gt;
          &lt;p class="small cc6"&gt;
            &lt;a href="http://www.wykop.pl/reklama/" class="link gray" title="Przejdź do Reklama Wykop.pl"&gt;
              &lt;span&gt;
                Wykop Poleca
              &lt;/span&gt;
            &lt;/a&gt; 
            dodany 
            &lt;time title="2011-09-26 19:37:24" datetime="2011-09-26T19:37:24+02:00" pubdate&gt;
              1 godz. temu
            &lt;/time&gt; 
            przez 
            &lt;a href="http://www.wykop.pl/ludzie/Saper86/" class="link gray color color-1"&gt;
              &lt;span&gt;
                Saper86
              &lt;/span&gt;
            &lt;/a&gt;
             z 
            &lt;a href="http://www.wykop.pl/link/partnerredirect/891309/policjant-strzelil-nastolatkowi-w-twarz-taserem-wideo/" rel="nofollow" class="link gray" title="Przejdź do Policjant strzelił nastolatkowi w twarz taserem [wideo"&gt;
              &lt;span&gt;
                gadzetomania.pl
              &lt;/span&gt;
            &lt;/a&gt;                                      
            do 
            &lt;a href="http://ciekawostki.wykop.pl/" title="Ciekawostki" class="link gray" rel="nofollow"&gt;
              &lt;span&gt;
                Ciekawostki
              &lt;/span&gt;
            &lt;/a&gt;
            &lt;a href="http://www.wykop.pl/link/891309/policjant-strzelil-nastolatkowi-w-twarz-taserem-wideo/" class="marginleft10 caf small tdnone"&gt;
              &lt;span class="icon inlblk comments mini vtop margintop5 "&gt;&amp;nbsp;&lt;/span&gt; 
              &lt;span class="hvline  link gray"&gt;13 komentarzy&lt;/span&gt;
            &lt;/a&gt;
          &lt;/p&gt;
        &lt;/header&gt;
  
        &lt;p class="lheight18"&gt;
          &lt;a href="http://www.wykop.pl/link/891309/policjant-strzelil-nastolatkowi-w-twarz-taserem-wideo/" class="block ce1"&gt;
            &lt;span class="c22"&gt;Oceńcie sami czy postąpił właściwie&lt;/span&gt;
          &lt;/a&gt;
        &lt;/p&gt;
  
      &lt;/div&gt;
  
    &lt;/div&gt;
  
  &lt;/article&gt;
  </code></pre>