Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #11051 (reopened defect)

Opened 1 year ago

Last modified 1 year ago

AutoCompleter.show in controls.js : IE-Fix is not working for IE7 in this case. (Prototype 1.6.0.2, Scriptaculous 1.8.1)

Reported by: ramumb Assigned to: sam
Priority: high Milestone: 2.1
Component: script.aculo.us Version: edge
Severity: normal Keywords: IE7 AutoCompleter DOCTYPE IEFix bug
Cc:

Description

Hi,

I've been playing with Prototype 1.6.0.2 and Scriptaculous 1.8.1 in my development environment. In doing so, I discovered two errors in IE7 when using Scriptaculous' Autocomplete widget. The errors appears to be coming from line 2252 ('style' is null or not an object) and line 2239 (Object doesn't support this property or method) in Prototype 1.6.0.2. Simply changing the code at these lines to first check for the property or method before executing them seems to fix the errors. For example:

Line 2252 in Prototype 1.6.0.2
FROM: var value = var value = element.style[style];
TO: var value = ( element.style ? element.style[style] : '');

Line 2239 in Prototype 1.6.0.2
FROM: if (offsetParent && offsetParent.getStyle('position') === 'fixed')
TO: if (offsetParent && offsetParent.getStyle && offsetParent.getStyle('position') === 'fixed')

Change History

02/08/08 01:42:10 changed by kangax

  • status changed from new to closed.
  • resolution set to duplicate.

Closed as duplicate of #11007

02/08/08 01:50:50 changed by kangax

An example of when this is happening would be really helpful. Which element are you invoking getOffsetParent on and which styles does that element have?

Thanks.

04/22/08 11:31:54 changed by chris78

  • status changed from closed to reopened.
  • resolution deleted.
  • component changed from Prototype to script.aculo.us.
  • severity changed from major to normal.
  • summary changed from element.style[style] and offsetParent.getStyle returns invalid property error in IE7 for Prototype 1.6.0.2 to AutoCompleter.show in controls.js : IE-Fix is not working for IE7 in this case. (Prototype 1.6.0.2, Scriptaculous 1.8.1).

Hi!

I have the same Problem as described above. Using the AutoCompleter in IE7 gives me an Error in prototype.js on line 2252 "'style' is null or not an object". Outputting the first parameter to getStyle (namely element) via alert, I can see it's undefined. So the calling method is responsible for the trouble. In this case the call is executed from controls.js line 113, within the IE-Fix of the AutoCompleter's show-method.

Here is some code to reproduce the problem. The JS-Files are of the following versions: prototype.js 1.6.0.2 controls.js 1.8.1 effects.js 1.8.1

I found out that removing the first line (!DOCTYPE...) works around the problem, but that's no solution of course...

Please help me fix that issue. Thanks and bye! Chris

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang='de' xml:lang='de' xmlns='http://www.w3.org/1999/xhtml'>
  <head>
    <title>test</title>
    <meta content='text/html;charset=utf-8' http-equiv='Content-Type' />
    <script src="/javascripts/prototype.js" type="text/javascript"></script>
    <script src="/javascripts/effects.js" type="text/javascript"></script>
    <script src="/javascripts/controls.js" type="text/javascript"></script>
  </head>
  
<body>
            <form action="/documents/enter_tag" id="enter_tag" method="post">
                 <input id="tag_list" name="tag[list]" size="30" type="text" />
                 <div class="auto_complete" id="tag_list_auto_complete"></div>
                 <script type="text/javascript">
                      var tag_list_auto_completer = new Ajax.Autocompleter('tag_list', 'tag_list_auto_complete', '/documents/auto_complete_for_tag_list', {})
                 </script>
            </form>
</body>
</html>

05/15/08 06:45:28 changed by chris78

  • keywords set to IE7 AutoCompleter DOCTYPE IEFix bug.
  • milestone changed from 2.x to 2.1.

07/07/08 20:53:08 changed by iono

well, I solved this problem by changing a few lines in <controls.js> // script.aculo.us controls.js v1.8.1, Thu Jan 03 22:07:12 -0500 2008

line 94

  show: function() {
      try {
          if (Element.getStyle(this.update, 'display') == 'none') this.options.onShow(this.element, this.update);
      }
      catch(e) {
          this.options.onShow(this.element, this.update);
      }