github github
  • Home
  • Pricing and Signup
  • Training
  • Gist
  • Blog
  • Login

jquery / jquery-ui

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
    • 1,145
    • 287
  • Source
  • Commits
  • Network (287)
  • Graphs
  • Tree: 1beb8a9

click here to add a description

click here to add a homepage

  • Switch Branches (8)
    • bind
    • devpreview
    • formcontrols
    • master
    • menu
    • panel
    • tooltip
    • widget-super
  • Switch Tags (22)
    • 1.9m2
    • 1.9m1
    • 1.8rc3
    • 1.8rc2
    • 1.8rc1
    • 1.8b1
    • 1.8a2
    • 1.8a1
    • 1.8.5
    • 1.8.4
    • 1.8.3
    • 1.8.2
    • 1.8.1
    • 1.8
    • 1.7
    • 1.6rc6
    • 1.6rc5
    • 1.6rc3
    • 1.6rc2
    • 1.6
    • 1.5.2
    • 1.5.1
  • Comments
  • Contributors
Sending Request…
Downloads

The official jQuery user interface library. — Read more

  Cancel

http://jqueryui.com/

  Cancel
  • HTTP
  • Git Read-Only

This URL has Read+Write access

Add _superApply method and use it in a few places
jzaefferer (author)
Thu Jun 17 08:21:16 -0700 2010
commit  1beb8a95be96282fdf0d
tree    3813e4e03298d91d19f5
parent  79b5f066998688081dbf

Showing 8 changed files with 28 additions and 8 deletions.

M tests/unit/widget/widget.js 16 •••••
M ui/jquery.ui.accordion.js 2 ••
M ui/jquery.ui.autocomplete.js 2 ••
M ui/jquery.ui.button.js 4 ••••
M ui/jquery.ui.progressbar.js 4 ••••
M ui/jquery.ui.slider.js 2 ••
M ui/jquery.ui.sortable.js 2 ••
M ui/jquery.ui.widget.js 4 ••••
Txt tests/unit/widget/widget.js
  • View file @ 1beb8a9
... ...
@@ -182,4 +182,20 @@ test("_super", function() {
182 182
   $("<div></div>").child().child("log");
183 183
 });
184 184
 
  185
+test("_superApply", function() {
  186
+  expect(2);
  187
+  $.widget("sup.parent", {
  188
+    log: function(a, b) {
  189
+      same( a, 1 );
  190
+      same( b, 2 );
  191
+    }
  192
+  });
  193
+  $.widget("sup.child", $.sup.parent, {
  194
+    log: function() {
  195
+      this._superApply("log", arguments);
  196
+    }
  197
+  });
  198
+  $("<div></div>").child().child("log", 1, 2);
  199
+});
  200
+
185 201
 })(jQuery);
Txt ui/jquery.ui.accordion.js
  • View file @ 1beb8a9
... ...
@@ -151,7 +151,7 @@ $.widget("ui.accordion", {
151 151
   },
152 152
   
153 153
   _setOption: function(key, value) {
154  
-    $.Widget.prototype._setOption.apply(this, arguments);
  154
+    this._superApply( "_setOption", arguments );
155 155
       
156 156
     if (key == "active") {
157 157
       this.activate(value);
Txt ui/jquery.ui.autocomplete.js
  • View file @ 1beb8a9
... ...
@@ -167,7 +167,7 @@ $.widget( "ui.autocomplete", {
167 167
   },
168 168
 
169 169
   _setOption: function( key ) {
170  
-    $.Widget.prototype._setOption.apply( this, arguments );
  170
+    this._superApply( "_setOption", arguments );
171 171
     if ( key === "source" ) {
172 172
       this._initSource();
173 173
     }
Txt ui/jquery.ui.button.js
  • View file @ 1beb8a9
... ...
@@ -230,7 +230,7 @@ $.widget( "ui.button", {
230 230
   },
231 231
 
232 232
   _setOption: function( key, value ) {
233  
-    $.Widget.prototype._setOption.apply( this, arguments );
  233
+    this._superApply( "_setOption", arguments );
234 234
     if ( key === "disabled" ) {
235 235
       if ( value ) {
236 236
         this.element.attr( "disabled", true );
... ...
@@ -324,7 +324,7 @@ $.widget( "ui.buttonset", {
324 324
       this.buttons.button( "option", key, value );
325 325
     }
326 326
 
327  
-    $.Widget.prototype._setOption.apply( this, arguments );
  327
+    this._superApply( "_setOption", arguments );
328 328
   },
329 329
   
330 330
   refresh: function() {
Txt ui/jquery.ui.progressbar.js
  • View file @ 1beb8a9
... ...
@@ -43,7 +43,7 @@ $.widget( "ui.progressbar", {
43 43
 
44 44
     this.valueDiv.remove();
45 45
 
46  
-    $.Widget.prototype.destroy.apply( this, arguments );
  46
+    this._superApply( "destroy", arguments );
47 47
   },
48 48
 
49 49
   value: function( newValue ) {
... ...
@@ -64,7 +64,7 @@ $.widget( "ui.progressbar", {
64 64
         break;
65 65
     }
66 66
 
67  
-    $.Widget.prototype._setOption.apply( this, arguments );
  67
+    this._superApply( "_setOption", arguments );
68 68
   },
69 69
 
70 70
   _value: function() {
Txt ui/jquery.ui.slider.js
  • View file @ 1beb8a9
... ...
@@ -511,7 +511,7 @@ $.widget( "ui.slider", $.ui.mouse, {
511 511
       valsLength = this.options.values.length;
512 512
     }
513 513
 
514  
-    $.Widget.prototype._setOption.apply( this, arguments );
  514
+    this._superApply( "_setOption", arguments );
515 515
 
516 516
     switch ( key ) {
517 517
       case "disabled":
Txt ui/jquery.ui.sortable.js
  • View file @ 1beb8a9
... ...
@@ -81,7 +81,7 @@ $.widget("ui.sortable", $.ui.mouse, {
81 81
         [ value ? "addClass" : "removeClass"]( "ui-sortable-disabled" );
82 82
     } else {
83 83
       // Don't call widget base _setOption for disable as it adds ui-state-disabled class
84  
-      $.Widget.prototype._setOption.apply(this, arguments);
  84
+      this._superApply( "_setOption", arguments );
85 85
     }
86 86
   },
87 87
 
Txt ui/jquery.ui.widget.js
  • View file @ 1beb8a9
... ...
@@ -151,6 +151,10 @@ $.Widget.prototype = {
151 151
     this.base[ method ].apply( this, Array.prototype.slice.call( arguments, 1 ) );
152 152
   },
153 153
   
  154
+  _superApply: function( method, args ) {
  155
+    this.base[ method ].apply( this, args );
  156
+  },
  157
+  
154 158
   destroy: function() {
155 159
     this.element
156 160
       .unbind( "." + this.widgetName )

0 notes on commit 1beb8a9

Please log in to comment.
Dedicated Server Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
  • Blog
  • Support
  • Training
  • Job Board
  • Shop
  • Contact
  • API
  • Status
  • © 2010 GitHub Inc. All rights reserved.
  • Terms of Service
  • Privacy
  • Security
  • English
  • Deutsch
  • Français
  • 日本語
  • Português (BR)
  • Русский
  • 中文
  • See all available languages

Your current locale selection: English. Choose another?

  • English
  • Afrikaans
  • Català
  • Čeština
  • Deutsch
  • Español
  • Français
  • Hrvatski
  • Indonesia
  • Italiano
  • 日本語
  • Nederlands
  • Norsk
  • Polski
  • Português (BR)
  • Русский
  • Српски
  • Svenska
  • 中文

Keyboard Shortcuts

Site wide shortcuts

s
Focus site search
?
Bring up this help dialog

Commit list

j
Move selected down
k
Move selected up
t
Open tree
p
Open parent
c or o or enter
Open commit

Pull request list

j
Move selected down
k
Move selected up
o or enter
Open issue

Issues

j
Move selected down
k
Move selected up
x
Toggle select target
o or enter
Open issue
I
Mark selected as read
U
Mark selected as unread
e
Close selected
y
Remove selected from view
c
Create issue
l
Create label
i
Back to inbox
u
Back to issues
/
Focus issues search

Network Graph

← or h
Scroll left
→ or l
Scroll right
↑ or k
Scroll up
↓ or j
Scroll down
t
Toggle visibility of head labels
shift ← or shift h
Scroll all the way left
shift → or shift l
Scroll all the way right
shift ↑ or shift k
Scroll all the way up
shift ↓ or shift j
Scroll all the way down