@@ -28,7 +28,27 @@ define([
2828 cssDisabled = document . createElement ( 'input' ) ,
2929 normalInput = document . createElement ( 'input' ) ,
3030 source = document . createElement ( 'input' ) ,
31- originalObserve = window . Event && window . Event . observe ;
31+ originalObserve = window . Event && window . Event . observe ,
32+ originalDollar = window . $ ,
33+ fakeTarget = {
34+ id : 'test_input_dependent' ,
35+ type : 'input' ,
36+ tagName : 'INPUT' ,
37+ getAttribute : function ( ) {
38+ return null ;
39+ } ,
40+ show : function ( ) { } ,
41+ hide : function ( ) { } ,
42+ up : function ( ) {
43+ return {
44+ show : function ( ) { } ,
45+ hide : function ( ) { } ,
46+ select : function ( ) {
47+ return [ cssDisabled , normalInput ] ;
48+ }
49+ } ;
50+ }
51+ } ;
3252
3353 document . body . appendChild ( container ) ;
3454 target . id = 'test_input_dependent' ;
@@ -47,32 +67,12 @@ define([
4767 if ( window . Event ) {
4868 window . Event . observe = function ( ) { } ;
4969 }
50- // Stub Prototype's $ to return a fake target implementing up().select() chain
51- var originalDollar = window . $ ;
52- var fakeTarget = {
53- id : 'test_input_dependent' ,
54- type : 'input' ,
55- tagName : 'INPUT' ,
56- getAttribute : function ( ) {
57- return null ;
58- } ,
59- show : function ( ) { } ,
60- hide : function ( ) { } ,
61- up : function ( ) {
62- return {
63- show : function ( ) { } ,
64- hide : function ( ) { } ,
65- select : function ( ) {
66- return [ cssDisabled , normalInput ] ;
67- }
68- } ;
69- }
70- } ;
71- window . $ = function ( id ) {
72- if ( id === 'test_input_dependent' ) {
70+
71+ window . $ = function ( elemId ) {
72+ if ( elemId === 'test_input_dependent' ) {
7373 return fakeTarget ;
7474 }
75- return document . getElementById ( id ) ;
75+ return document . getElementById ( elemId ) ;
7676 } ;
7777 /* eslint-disable no-new */
7878 new window . FormElementDependenceController ( {
0 commit comments