IE9 textangular issue - angularjs

I'm receiving the following textangular error in IE9 or below.
unable to get the value of the property 'match': object is null or undefined textangular.js line 107 character 3
Here is the block of code that causes the error:
if(_browserDetect.ie > 8 || _browserDetect.ie === undefined){
var _sheets = document.styleSheets;
/* istanbul ignore next: preference for stylesheet loaded externally */
for(var i = 0; i < _sheets.length; i++){
if(_sheets[i].media.length === 0 || _sheets[i].media.mediaText.match(/(all|screen)/ig)){
if(_sheets[i].href){
if(_sheets[i].href.match(/textangular\.(min\.|)css/ig)){
sheet = _sheets[i];
break;
}
}
}
}
Line 107 is starts the first if block
TextAngular works correctly without error in all other browsers, just IE9 and below is returning the above error.

Related

Strange IE11 behavior with "Object doesn't support property or method 'includes'"

I have some trouble with my project in IE11 (It's react project, I use create-react-app prod build). It works fine in other browsers and in IE11 too, except if I click precise link to one route in IE11 (other routes work), it throws an error "Object doesn't support property or method 'includes'". I added 'babel-polyfill' but problem still exists, but if I, for example, not just load page, but reload it then too and then click that link, or when I load directly that link page it works fine.
I don't use 'includes' in my code, suppose it is used in some library, among those I use.
May be someone know, why it not work properly after loading page and after reloading only.
Thanks for help.
It appears to be handled separately from the rest of babel through this plugin.
includes is a Javascript function that determines whether an item exists in an array, and it is not available in Internet Explorer. See docs/chart below. (Apparently it isn't part of babel by default because of some difficulty identifying whether a variable is an array. There are issues around this going back 2+ years in the babel repos.)
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/includes
Part of the browser compatibility chart from those docs:
McGuireV10's answer is great if you can control your javascript compilation process, however including a shim might be faster.
In my create-react-app project using react-select v2 i was hitting a few of these errors, and so included air-bnb's bundle:
yarn add airbnb-js-shims
and then added this single line to my code:
import 'airbnb-js-shims';
good luck!
Add below function in top of the all imports.
if (!Array.prototype.includes) {
Object.defineProperty(Array.prototype, 'includes', {
value: function (searchElement, fromIndex) {
if (this == null) {
throw new TypeError('"this" is null or not defined');
}
// 1. Let O be ? ToObject(this value).
var o = Object(this);
// 2. Let len be ? ToLength(? Get(O, "length")).
var len = o.length >>> 0;
// 3. If len is 0, return false.
if (len === 0) {
return false;
}
// 4. Let n be ? ToInteger(fromIndex).
// (If fromIndex is undefined, this step produces the value 0.)
var n = fromIndex | 0;
// 5. If n ≥ 0, then
// a. Let k be n.
// 6. Else n < 0,
// a. Let k be len + n.
// b. If k < 0, let k be 0.
var k = Math.max(n >= 0 ? n : len - Math.abs(n), 0);
function sameValueZero(x, y) {
return x === y || (typeof x === 'number' && typeof y === 'number' && isNaN(x) && isNaN(y));
}
// 7. Repeat, while k < len
while (k < len) {
// a. Let elementK be the result of ? Get(O, ! ToString(k)).
// b. If SameValueZero(searchElement, elementK) is true, return true.
if (sameValueZero(o[k], searchElement)) {
return true;
}
// c. Increase k by 1.
k++;
}
// 8. Return false
return false;
}
});
}

How do I Assert against an Array and failing only if there is no match after all the values were verified

I am working on a test using NightwatchJs framework. I need to compare the actual value against a set of valid values. However my current implementation throws multiple failures while the correct value is found in the expected result array. I want to display the output of the test, only if NO value matches or if the test pass.
Given that I have the following array:
var topDesktop = [['728', '90'], ['970', '250'], ['970', '90'], ['980', '250'], ['980', '240'], ['980', '120'], ['980', '90'], ['1000', '90'], ['1000', '300']];
And I want to know if the current value is within the allowed values (topDesktop array).
var actual = result.toString();
for(var i = 0; i < topDesktop.length; i++){
client.assert.equal(actual, topDesktop[i]);
}
The output for obvious reasons is the result of the for loop:
✔ Passed [equal]: 728,90 == [ '728', '90' ]
✖ Failed [equal]: ('728,90' == [ '970', '250' ]) - expected "970,250" but got: "728,90"
✖ Failed [equal]: ('728,90' == [ '970', '90' ]) - expected "970,90" but got: "728,90"
✖ Failed [equal]: ('728,90' == [ '980', '250' ]) - expected "980,250" but got: "728,90"
.
.
.
What I like to avoid, is to have a failure per match attempt. Any brilliant idea?
If I understood correctly, you want to find out if the actual value, is in one of the expected values. If so, you can do the following:
var actual = result.toString();
var isFound = false;
for(var i = 0; i < topDesktop.length; i++) {
if(actual == topDesktop[i]) {
isFound = true;
break;
}
}
client.assert.equal(isFound, true);
Like this, if the value is found, it won't continue checking, since the break will stop the for loop, and finally you will check if the value was found or not.
Filter out the elements you want. Make sure at least one exists
client.assert(topDesktop.filter(e => actual == e).length > 0)

CodenameOne IOS app crashing due to null threadsToDelete

I have a codenameOne app that works fine on Android but occasionally crashes on iOS.
From xcode it looks like its failing at:
JAVA_VOID java_lang_Thread_releaseThreadNativeResources___long(CODENAME_ONE_THREAD_STATE, JAVA_LONG nativeThreadId) {
for(int i = 0 ; i < NUMBER_OF_SUPPORTED_THREADS ; i++) {
if(threadsToDelete[i] != 0 && threadsToDelete[i]->threadId == nativeThreadId) {
free(threadsToDelete[i]->blocks);
free(threadsToDelete[i]->threadObjectStack);
free(threadsToDelete[i]->callStackClass);
free(threadsToDelete[i]->callStackLine);
free(threadsToDelete[i]->callStackMethod);
free(threadsToDelete[i]->pendingHeapAllocations);
free(threadsToDelete[i]);
threadsToDelete[i] = 0;
break;
}
}
}
in nativeMethods.m. It says threadsToDelete is null in that if statement. This seems to happen when I open a new form showing a picture, then switch back to the original form. I do start a new thread to save certain details to amazon. But it doesn't crash everytime.
I have fixed this issue in Github here. It will be included with the next build server update (probably today, possibly next week).

Markers and Windows(Angular google maps) not working after upgrade to angular 1.3.8

I have been using angular-google-maps for sometime. I have not faced any major issues till now. But one of my colleagues had upgraded angular to 1.3.8 recently. And since then I am getting the following errors while instantiating the and directives and I do not see any markers. Here are the errors I get. Any inputs or directions to debug will be awesome. Thanks in advance.
Here is the first error:
Error: this.mapCtrl.getMap is not a function
this.MarkersParentModel</MarkersParentModel.prototype.createMarkers#http://localhost/scripts/1b3f05c4.modules.js:2637:75
__bind/<#http://localhost/scripts/1b3f05c4.modules.js:2569:16
this.MarkersParentModel</MarkersParentModel.prototype.onTimeOut#http://localhost/scripts/1b3f05c4.modules.js:2612:16
__bind/<#http://localhost/scripts/1b3f05c4.modules.js:2569:16
__bind/<#http://localhost/scripts/1b3f05c4.modules.js:2234:16
IMarkerParentModel/<#http://localhost/scripts/1b3f05c4.modules.js:2290:11
timeout/timeoutId<#http://localhost/bower_components/angular/angular.js:16205:28
completeOutstandingRequest#http://localhost/bower_components/angular/angular.js:4902:7
Browser/self.defer/timeoutId<#http://localhost/bower_components/angular/angular.js:5282:7
http://localhost/bower_components/angular/angular.js
Line 11594
And here is the second error:
Error: this.linked.ctrls[0].getMap is not a function
this.WindowsParentModel</WindowsParentModel.prototype.createChildScopesWindows#http://localhost/scripts/1b3f05c4.modules.js:2860:21
__bind/<#http://localhost/scripts/1b3f05c4.modules.js:2726:16
WindowsParentModel/<#http://localhost/scripts/1b3f05c4.modules.js:2785:18
timeout/timeoutId<#http://localhost/bower_components/angular/angular.js:16205:28
completeOutstandingRequest#http://localhost/bower_components/angular/angular.js:4902:7
Browser/self.defer/timeoutId<#http://localhost/bower_components/angular/angular.js:5282:7
http://localhost/bower_components/angular/angular.js
Line 11594
Line 2860:
var markersScope, modelsNotDefined, _this = this;
this.isIconVisibleOnClick = true;
if (angular.isDefined(this.linked.attrs.isiconvisibleonclick)) {
this.isIconVisibleOnClick = this.linked.scope.isIconVisibleOnClick;
}
>>>> this.gMap = this.linked.ctrls[0].getMap();
markersScope = this.linked.ctrls.length > 1 && this.linked.ctrls[1] != null ? this.linked.ctrls[1].getMarkersScope() : void 0;
modelsNotDefined = angular.isUndefined(this.linked.scope.models);
if (modelsNotDefined && (markersScope === void 0 || markersScope.markerModels === void 0 && markersScope.models === void 0)) {
this.$log.info('No models to create windows from! Need direct models or models derrived from markers!');
return;
}
Line 2637:
this.gMarkerManager = new directives.api.managers.MarkerManager(this.mapCtrl.getMap());

Zend framework Undefined class constant '' in Zend/Db/Select.php

There is a srange error in my Apache Log :
PHP Fatal error: Undefined class constant ''
This is on line 814 of de library (Zend framework 1.11) library/Zend/Db/Select.php
A look of the code :
if ($type == self::FROM) {
// append this from after the last from joinType
$tmpFromParts = $this->_parts[self::FROM];
$this->_parts[self::FROM] = array();
// move all the froms onto the stack
while ($tmpFromParts) {
$currentCorrelationName = key($tmpFromParts);
if ($tmpFromParts[$currentCorrelationName]['joinType'] != self::FROM) {
break;
}
$lastFromCorrelationName = $currentCorrelationName;
$this->_parts[self::FROM][$currentCorrelationName] = array_shift($tmpFromParts);
} }
That's strange because the undefined constant is empty.
THis fatal error appears some times but not at every load of pages.
Is it a release BUG of the zend framework?

Resources