From fcfd9fe9d47fcc36c26dca96d1d4d7a6787240b5 Mon Sep 17 00:00:00 2001 From: Justin Willis Date: Fri, 15 Apr 2016 13:58:09 -0500 Subject: [PATCH 1/2] New rule to prevent nested function declaration that causes an issue with strict mode --- package.json | 3 ++- tslint.json | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index dc6aab5996..b20551ce4e 100644 --- a/package.json +++ b/package.json @@ -80,6 +80,7 @@ "systemjs": "0.19.6", "through2": "^0.6.3", "tslint": "^3.7.1", + "tslint-eslint-rules": "^1.2.0", "typescript": "1.8.7", "vinyl": "^0.4.6", "webpack": "^1.12.2", @@ -90,4 +91,4 @@ "path": "node_modules/ionic-cz-conventional-changelog" } } -} \ No newline at end of file +} diff --git a/tslint.json b/tslint.json index 0173f9ad1f..56ca642ff0 100644 --- a/tslint.json +++ b/tslint.json @@ -1,4 +1,5 @@ { + "rulesDirectory": "node_modules/tslint-eslint-rules/dist/rules", "rules": { "class-name": true, "comment-format": [ @@ -52,6 +53,10 @@ "check-operator", "check-separator", "check-type" + ], + "no-inner-declarations": [ + true, + "functions" ] } } \ No newline at end of file From c8e58e58a083c2477c9d9076cacddf99a1f41a67 Mon Sep 17 00:00:00 2001 From: Justin Willis Date: Fri, 15 Apr 2016 14:14:47 -0500 Subject: [PATCH 2/2] fix(input): move nested function outside of if statment so as to fix issue related to strict mode There was a white screen issue caused on ios because of a nested function declaration in the input component. I moved this function out of the if statement so as to fix this issue. closes issue 187 on conference app repo --- ionic/components/input/native-input.ts | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/ionic/components/input/native-input.ts b/ionic/components/input/native-input.ts index 7073a665e2..23aa23a030 100644 --- a/ionic/components/input/native-input.ts +++ b/ionic/components/input/native-input.ts @@ -40,20 +40,22 @@ export class NativeInput { var self = this; self.focusChange.emit(true); + + function docTouchEnd(ev) { + var tappedElement: any = ev.target; + if (tappedElement && self.element()) { + if (tappedElement.tagName !== "INPUT" && tappedElement.tagName !== "TEXTAREA") { + self.element().blur(); + } + } + } if (self._blurring) { // automatically blur input if: // 1) this input has focus // 2) the newly tapped document element is not an input console.debug('input blurring enabled'); - function docTouchEnd(ev) { - var tappedElement: any = ev.target; - if (tappedElement && self.element()) { - if (tappedElement.tagName !== 'INPUT' && tappedElement.tagName !== 'TEXTAREA') { - self.element().blur(); - } - } - } + document.addEventListener('touchend', docTouchEnd, true); self._unrefBlur = function() { console.debug('input blurring disabled');