[richfaces-issues] [JBoss JIRA] (RF-12860) Overridng 'Array.prototype.remove' causes JS error when rich:accordion is used

Jan Papousek (JIRA) jira-events at lists.jboss.org
Wed Mar 27 08:10:43 EDT 2013


     [ https://issues.jboss.org/browse/RF-12860?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jan Papousek updated RF-12860:
------------------------------

               Summary: Overridng 'Array.prototype.remove' causes JS error when rich:accordion is used  (was: AccordionItem.js with error cause browser crash)
           Description: 
Put the rich:accordionItem and rich:extendedDataTable on same page,
and just click on any column for sort.

The firebug will show an error:
items[i].__header is not a function
[Break On This Error] 	

h -= items[i].__header().outerHeight();

Looks like accordionItem.js line48 been triggered when sort:
$(document).one("javascriptServiceComplete", function () {
item.__fitToHeight(item.getTogglePanel());
}); 

And after this happened, my whole thing crashed.
Now more sortable or click for any action.

----

*from QA:*

When the following code is insterted to the page:

{code}
<script type="text/javascript">
    //<![CDATA[
    Array.prototype.remove = function(s) {
        for (var i = 0; i < this.length; i++) {
            if (s == this[i]) {
                this.splice(i, 1);
            }
        }
    };
    //]]>
</script>
{code}

and rich:accordion is present, clicking on rich:accordionItem causes the following JS error (from firebug):

{code}
items[i].__header is not a function
[Break On This Error] 	

h -= items[i].__header().outerHeight();
{code}

  was:
Put the rich:accordionItem and rich:extendedDataTable on same page,
and just click on any column for sort.

The firebug will show an error:
items[i].__header is not a function
[Break On This Error] 	

h -= items[i].__header().outerHeight();

Looks like accordionItem.js line48 been triggered when sort:
$(document).one("javascriptServiceComplete", function () {
item.__fitToHeight(item.getTogglePanel());
}); 

And after this happened, my whole thing crashed.
Now more sortable or click for any action.

    Steps to Reproduce: 
# clone https://github.com/papousek/richfaces-sanbox/tree/RF-12860 or download the application from attachments, built it and deploy it
# open http://localhost:8080/richfaces-sandbox-jee6/
# open firebug console
# click on the second item in accordion => JS error appears

    
> Overridng 'Array.prototype.remove' causes JS error when rich:accordion is used
> ------------------------------------------------------------------------------
>
>                 Key: RF-12860
>                 URL: https://issues.jboss.org/browse/RF-12860
>             Project: RichFaces
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>          Components: component-output
>    Affects Versions: 4.3.0.Final
>         Environment: JBOSS7/JSF2/FirefoxESR10 or Chrome25.0.1
>            Reporter: David Lee
>            Assignee: Jan Papousek
>              Labels: javascript, rich:accordionItem
>             Fix For: 4.3.2
>
>         Attachments: richfaces-sanbox.zip
>
>
> Put the rich:accordionItem and rich:extendedDataTable on same page,
> and just click on any column for sort.
> The firebug will show an error:
> items[i].__header is not a function
> [Break On This Error] 	
> h -= items[i].__header().outerHeight();
> Looks like accordionItem.js line48 been triggered when sort:
> $(document).one("javascriptServiceComplete", function () {
> item.__fitToHeight(item.getTogglePanel());
> }); 
> And after this happened, my whole thing crashed.
> Now more sortable or click for any action.
> ----
> *from QA:*
> When the following code is insterted to the page:
> {code}
> <script type="text/javascript">
>     //<![CDATA[
>     Array.prototype.remove = function(s) {
>         for (var i = 0; i < this.length; i++) {
>             if (s == this[i]) {
>                 this.splice(i, 1);
>             }
>         }
>     };
>     //]]>
> </script>
> {code}
> and rich:accordion is present, clicking on rich:accordionItem causes the following JS error (from firebug):
> {code}
> items[i].__header is not a function
> [Break On This Error] 	
> h -= items[i].__header().outerHeight();
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the richfaces-issues mailing list