Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 142cffc

Browse files
Di PengIgorMinar
Di Peng
authored andcommitted
refactor(widgets): remove input[button, submit, reset, image] and button windgets
These widgets are useless and only trigger extra $updateViews. The only reason we had them was to support ng:change on these widgets, but since there are no bindings present in these cases it doesn't make sense to support ng:change here. It's likely just a leftover from getangular.com Breaking change: ng:change for input[button], input[submit], input[reset], input[image] and button widgets is not supported any more
1 parent 862d78c commit 142cffc

File tree

2 files changed

+1
-18
lines changed

2 files changed

+1
-18
lines changed

src/widgets.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -445,16 +445,11 @@ function noopAccessor() { return { get: noop, set: noop }; }
445445
*
446446
*/
447447
var textWidget = inputWidget('keydown change', modelAccessor, valueAccessor, initWidgetValue(), true),
448-
buttonWidget = inputWidget('click', noopAccessor, noopAccessor, noop),
449448
INPUT_TYPE = {
450449
'text': textWidget,
451450
'textarea': textWidget,
452451
'hidden': textWidget,
453452
'password': textWidget,
454-
'button': buttonWidget,
455-
'submit': buttonWidget,
456-
'reset': buttonWidget,
457-
'image': buttonWidget,
458453
'checkbox': inputWidget('click', modelFormattedAccessor, checkedAccessor, initWidgetValue(false)),
459454
'radio': inputWidget('click', modelFormattedAccessor, radioAccessor, radioInit),
460455
'select-one': inputWidget('change', modelAccessor, valueAccessor, initWidgetValue(null)),
@@ -566,7 +561,7 @@ function inputWidgetSelector(element){
566561

567562
angularWidget('input', inputWidgetSelector);
568563
angularWidget('textarea', inputWidgetSelector);
569-
angularWidget('button', inputWidgetSelector);
564+
570565

571566
/**
572567
* @workInProgress

test/widgetsSpec.js

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -295,18 +295,6 @@ describe("widget", function(){
295295
expect(scope.name).toEqual('Kai');
296296
});
297297

298-
it('should call ng:change on button click', function(){
299-
compile('<input type="button" value="Click Me" ng:change="clicked = true"/>');
300-
browserTrigger(element);
301-
expect(scope.clicked).toEqual(true);
302-
});
303-
304-
it('should support button alias', function(){
305-
compile('<button ng:change="clicked = true">Click {{"Me"}}.</button>');
306-
browserTrigger(element);
307-
expect(scope.clicked).toEqual(true);
308-
expect(scope.$element.text()).toEqual("Click Me.");
309-
});
310298

311299
describe('radio', function(){
312300

0 commit comments

Comments
 (0)