[
https://issues.apache.org/jira/browse/WICKET-2253?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12706055#action_12706055
]
Per Cederberg commented on WICKET-2253:
---------------------------------------
Crap. This issue is 100% reproducible for our application, but after spending
half a day trying to isolate the issue it has proven virtually impossible to
track down. Perhaps it is some weird combination of doing "document.write()"
and having lots of HTML, forms and stuff. Don't really know. Perhaps related to
having multiple ondomready event handlers.
I guess we'll have to keep our local patch for now. Hopefully IE7 will have
disappeared in 4-5 years...
> JavaScript null reference in IE7 for autocomplete text fields added by AJAX
> ---------------------------------------------------------------------------
>
> Key: WICKET-2253
> URL: https://issues.apache.org/jira/browse/WICKET-2253
> Project: Wicket
> Issue Type: Bug
> Reporter: Per Cederberg
> Fix For: 1.3.6, 1.4-RC2
>
>
> IE7 displays an null reference error when adding a Wicket
> AutoCompleteTextField to a form as part of an AJAX response. This is caused
> by the INPUT DOM element not being immediately accessible, since it is added
> as HTML text (via innerHTML) instead of via the normal DOM API:s. So, the
> JavaScript autocomplete initialization code must be delayed until the HTML
> code has been parsed and properly inserted into the DOM tree.
> We've solved this by patching our local copy of Wicket 1.3.x in the
> wicket-autocomplete.js file:
> @@ -39,6 +37,7 @@
> var KEY_CTRL=17;
> var KEY_ALT=18;
>
> + var initCounter=10; // counter to avoid eternal init calls
> var selected=-1; // index of the currently selected item
> var elementCount=0; // number of items on the auto complete list
> var visible=0; // is the list visible
> @@ -63,6 +62,24 @@
> var throttleDelay = 300;
>
> function initialize(){
> + // Ugly hack to avoid null reference in IE7...
> + if (initCounter <= 0) {
> + return;
> + }
> + initCounter--;
> + var obj=wicketGet(elementId);
> + if (obj == null) {
> + setTimeout(initialize, 100);
> + return;
> + }
> + initCounter=0;
> +
> + // Avoid initializing same element twice
> + if (obj.wicketInit) {
> + return;
> + }
> + obj.wicketInit=true;
> This is not an optimal solution, but with the current Wicket solution of
> injecting HTML code as text into the DOM tree one is forced to poll for the
> inserted DOM node...
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.