nitesh13t / google-ajax-apis

Automatically exported from code.google.com/p/google-ajax-apis
0 stars 0 forks source link

Virtual Keyboard is Incompatible with Prototype JS API #317

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. http://djmp.org/statik/googleKeyboardTest.html (also attached)

- OR -
Setup a test page with
google.load("prototype","1.6.0.3");
google.load("elements", "1", {
  packages: "keyboard"
});
An exception will be thrown when clicking on a text field listened to by 
the Keyboard object.

What is the expected output? What do you see instead?
the keyboard appears on page load, then disappears when focusing in the 
text field attached with the Keyboard object.

What version of the product are you using? On what operating system?
Version 1 of the "keyboard" package of "elements". Errors occurred on 
Firefox 3.5.3 and Safari 3.2.2 on Windows XP.

Please provide any additional information below.
Errors occur when using Prototype, but not when using jQuery. 

Original issue reported on code.google.com by statikef...@gmail.com on 15 Sep 2009 at 8:50

Attachments:

GoogleCodeExporter commented 9 years ago
The specific javascript runtime errors, as thrown in Google Chrome, are as 
follows:
[The HTML that caused this error was generated by a script.] Unmatched </link> 
encountered.  Ignoring tag.
www.google.com/uds/api/elements/1.0/23226509013e52ac5d30d65ae4af902d/keyboard.I.
js:47
Uncaught function (inline) {
    return (inline !== false ? this : this.toArray())._reverse();
  } is not a supported layout.
www.google.com/uds/api/elements/1.0/23226509013e52ac5d30d65ae4af902d/keyboard.I.
js:50
Uncaught TypeError: Object function (inline) {
    return (inline !== false ? this : this.toArray())._reverse();
  } has no method 'rc'

Original comment by statikef...@gmail.com on 16 Sep 2009 at 1:19

GoogleCodeExporter commented 9 years ago
To fix this problem, Google should, while iterating through an Array object, 
perform
type-checking on the array value. If it is a function (i.e. the Prototype 
.each()
method) ignore it and continue.
In this case it is picking up the each() method when expecting a KEYBOARD 
LAYOUT element.

Original comment by statikef...@gmail.com on 19 Sep 2009 at 3:05

GoogleCodeExporter commented 9 years ago

Original comment by jscud.w...@gmail.com on 22 Sep 2009 at 8:03

GoogleCodeExporter commented 9 years ago
The issue seems to be $.l on line 50 of keyboard.l.js, where a normal for loop 
should be used to iterate instead 
of for..in. See also http://api.prototypejs.org/language/array.html and 
http://andrewdupont.net/2006/05/18/javascript-associative-arrays-considered-harm
ful/, avoiding the use of 
for..in in this manner should be done in general to avoid these kinds of 
problems.

Original comment by rfbaum...@gmail.com on 18 Nov 2009 at 9:45