Skip to content

Commit

Permalink
feat(ionic): remove angular-sanitize (ngSanitize) as dependency
Browse files Browse the repository at this point in the history
Add small bindHtmlUnsafe directive without html checking
  • Loading branch information
ajoslin committed Feb 6, 2014
1 parent 1fd3f39 commit e755623
Show file tree
Hide file tree
Showing 12 changed files with 628 additions and 38 deletions.
3 changes: 0 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ notifications:
hipchat:
rooms:
secure: mkHfRTsuxidtOOORbJJ0Jspb/DSa8jAiQwWWUljqLwefy1p4HGC9P/rLdXXg3vsjiulCzyjEkfvDWAHXvu34GhGWfQuD8U140Fon1Os3AO5Hbme+yRmjXmTcgH8XetSLQufyBBMqXHMd6o1tkxXql1p54G1IShhgAdPNe76d5ZE=
template:
- '<a href="%{build_url}">%{repository}: build#%{build_number}</a> #{message} (%{branch} - %{commit} : %{author})'
format: html

before_install:
- gem update --system
Expand Down
2 changes: 2 additions & 0 deletions config/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ module.exports = {
vendorFiles: [
'js/angular/angular-animate.js',
'js/angular/angular-animate.min.js',
'js/angular/angular-resource.js',
'js/angular/angular-resource.min.js',
'js/angular/angular-sanitize.js',
'js/angular/angular-sanitize.min.js',
'js/angular/angular.js',
Expand Down
1 change: 0 additions & 1 deletion config/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ module.exports = function(config) {
'config/lib/js/angular/angular.js',
'config/lib/js/angular/angular-animate.js',
'config/lib/js/angular/angular-mocks.js',
'config/lib/js/angular/angular-sanitize.js',
'config/lib/js/angular-ui/angular-ui-router.js',
]
.concat(buildConfig.ionicFiles)
Expand Down
8 changes: 0 additions & 8 deletions config/lib/js/angular/angular-animate.min.js.map

This file was deleted.

594 changes: 594 additions & 0 deletions config/lib/js/angular/angular-resource.js

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions config/lib/js/angular/angular-resource.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 0 additions & 8 deletions config/lib/js/angular/angular-sanitize.min.js.map

This file was deleted.

8 changes: 0 additions & 8 deletions config/lib/js/angular/angular.min.js.map

This file was deleted.

6 changes: 3 additions & 3 deletions js/ext/angular/src/directive/ionicBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ angular.module('ionic.ui.header', ['ngAnimate'])
transclude: true,
template: '<header class="bar bar-header">\
<div class="buttons">\
<button ng-repeat="button in leftButtons" class="button no-animation" ng-class="button.type" ng-click="button.tap($event, $index)" ng-bind-html="button.content">\
<button ng-repeat="button in leftButtons" class="button no-animation" ng-class="button.type" ng-click="button.tap($event, $index)" bind-html-unsafe="button.content">\
</button>\
</div>\
<h1 class="title" ng-bind-html="title"></h1>\
<h1 class="title" bind-html-unsafe="title"></h1>\
<div class="buttons">\
<button ng-repeat="button in rightButtons" class="button no-animation" ng-class="button.type" ng-click="button.tap($event, $index)" ng-bind-html="button.content">\
<button ng-repeat="button in rightButtons" class="button no-animation" ng-class="button.type" ng-click="button.tap($event, $index)" bind-html-unsafe="button.content">\
</button>\
</div>\
</header>',
Expand Down
10 changes: 5 additions & 5 deletions js/ext/angular/src/directive/ionicViewState.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ angular.module('ionic.ui.viewState', ['ionic.service.view', 'ionic.service.gestu
// Clone the old title and add a new one so we can show two animating in and out
// add ng-leave and ng-enter during creation to prevent flickering when they are swapped during animation
title = angular.element(titles[0]);
oTitle = $compile('<h1 class="title" ng-bind-html="oldTitle"></h1>')($scope);
oTitle = $compile('<h1 class="title" bind-html-unsafe="oldTitle"></h1>')($scope);
title.replaceWith(oTitle);
nTitle = $compile('<h1 class="title" ng-bind-html="currentTitle"></h1>')($scope);
nTitle = $compile('<h1 class="title" bind-html-unsafe="currentTitle"></h1>')($scope);

var insert = $element[0].firstElementChild || null;

Expand All @@ -70,11 +70,11 @@ angular.module('ionic.ui.viewState', ['ionic.service.view', 'ionic.service.gestu
template: '<header class="bar bar-header nav-bar invisible">' +
'<div class="buttons"> ' +
'<button view-back class="button" ng-if="enableBackButton"></button>' +
'<button ng-click="button.tap($event)" ng-repeat="button in leftButtons" class="button no-animation {{button.type}}" ng-bind-html="button.content"></button>' +
'<button ng-click="button.tap($event)" ng-repeat="button in leftButtons" class="button no-animation {{button.type}}" bind-html-unsafe="button.content"></button>' +
'</div>' +
'<h1 class="title" ng-bind-html="currentTitle"></h1>' +
'<h1 class="title" bind-html-unsafe="currentTitle"></h1>' +
'<div class="buttons" ng-if="rightButtons.length"> ' +
'<button ng-click="button.tap($event)" ng-repeat="button in rightButtons" class="button no-animation {{button.type}}" ng-bind-html="button.content"></button>' +
'<button ng-click="button.tap($event)" ng-repeat="button in rightButtons" class="button no-animation {{button.type}}" bind-html-unsafe="button.content"></button>' +
'</div>' +
'</header>',

Expand Down
4 changes: 2 additions & 2 deletions js/ext/angular/src/ionicAngular.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ angular.module('ionic.ui.service', [
]);

angular.module('ionic.ui', [
'ionic.ui.bindHtml',
'ionic.ui.content',
'ionic.ui.scroll',
'ionic.ui.tabs',
Expand All @@ -40,9 +41,8 @@ angular.module('ionic', [
'ionic.service',
'ionic.ui.service',
'ionic.ui',

// Angular deps
'ngAnimate',
'ngSanitize',
'ui.router'
]);
9 changes: 9 additions & 0 deletions js/ext/angular/test/directive/ionicBindHtml.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
angular.module('ionic.ui.bindHtml', [])
.directive('bindHtmlUnsafe', function () {
return function (scope, element, attr) {
element.addClass('ng-binding').data('$binding', attr.bindHtmlUnsafe);
scope.$watch(attr.bindHtmlUnsafe, function(value) {
element.html(value || '');
});
};
});

0 comments on commit e755623

Please sign in to comment.