Can't destroy CKEditor instances - javascript

I'm trying to refresh all my CKEditor instances using this code:
for(name in CKEDITOR.instances)
{
console.log(name);
CKEDITOR.instances[name].destroy();
//Also tried this
//CKEDITOR.instances[name].destroy(true);
}
CKEDITOR.inlineAll();
and I'm receiving this:
Uncaught TypeError: Cannot call method 'getRanges' of null.
The interesting part is that, if I use the code directly in the console, it works just fine.
Anyone has any idea on how to solve it?

Check this bug report: http://dev.ckeditor.com/ticket/10219
In 4.1 and 4.0.3 we have partially fixed this issue, but... only partially :). However, this error shouldn't cause any problems - it is completely harmless.

I also had the same issue but it seems to be fixed in ck-editor-dev repositories.
Somebody checked in a fix 2 days ago for CKEDITOR 4.1.1 milestone.
Check http://dev.ckeditor.com/ticket/10219 again to access the change link in git.

Related

protractor problem: not working consistently

I work with protractor v5.4.2, then i have a issue regarding the consistency of my scripts, the problem the same script sometimes it works the next run it doesn't.
I tried changing jasmine and protractor versions but no luck.
Generaly the errors are :
-Element not interectable.
-No element found using locator. Despite the elements are present and displayed so logicly they are selectabale correctly
Help will be appreciated.

Kendo Drop Down List Widget breaks when filter property set

I have a kendo drop down list tied to a remote data source. I've followed the documentation and configured virtualization and the remote data source is working as intended, but if the Filter option is set at all, bluring out of the open drop down throws an error in JS, and selecting anything throws an error in JS. The only way to close the list is clicking on the close arrow in the drop down widget.
Below are screens of the errors i'm seeing in the console. 'Add' of undefined occurs when selecting an item:
'Attr' of undefined occurs when clicking outside of the drop down list to blur and close.
I'm at a loss here. Any addition of the filter option causes these errors. I've isolated that as the issue by systematically removing every possible option and the only thing that seems to prevent the errors from occurring is the filter option:
#(Html.Kendo().DropDownList()
.Name("MyDropDown")
.DataTextField("MyText")
.DataValueField("Id")
.Filter(FilterType.Contains) //<--This guy right here
...
..more code..
...
)
I've tried it in just JavaScript, I've tried it using the kendo ASP.NET MVC wrappers and the .ToClientTemplate option. I've tried it just using the MVC wrappers alone. I must be missing something but alas I do not see it.
EDIT: The issue seems to be happening in the close handler in kendo.all.js:
_closeHandler: function (e) {
if (this.trigger(CLOSE)) {
e.preventDefault();
} else {
this._focused.attr('aria-expanded', false);
this.ul.attr('aria-hidden', true);
}
},
When it goes to set the aria-expanded to false on close, the _focused property is undefined. This happens before the close event, as I tried to hook into close to see if there is something in there I can manually correct. Is there any reason why this script isn't working? Am I missing a file? Everything appears to be configured correctly, but nevertheless, the widget is broken.
Edit #2: I thought maybe there was something wrong with the kendo libs, or some mismatch between libraries, or that this was possibly a bug in an older version, so I udpated my kendo libraries and the mvc wrapper to the newest version (2018.1.117) and the exact same issue is still happening. I thought maybe there was a mismatch in jquery version somehow that was causing the issue, but according to the documentation, version 2018.1.117 requires jQuery version 1.12.4, which i'm using. Just updated all the libraries and dependencies and i'm still getting the error.
In setting up an isolated test of the issue, I stumbled on to a line in a 3rd party script that was hijacking jQuery.fn.focus, which apparently had some serious side effects. Removing this line in the 3rd party script appeared to fix the issue entirely.
Try .Filter("contains"), might do the trick.

Zombie.js jQuery Load Error 'j.getClientRects is not a function'

So first I have read this Stack Overflow question and it doesn't look like my same issue.
Basically I'm trying to use Mocha and Zombie.js to run some tests on my Node.js site.
I'm trying to check to see if I can create a user. In the end I would like to check to see if my bootstrap modal exists. Basically I have the bootstrap modal wrapped in an EJS if statement so there is defiantly a chance it might not exist. So that is why I'm trying to run tests on it.
But currently it's not even working with browser.assert.success(); so I'm currently just trying to solve this before moving on to checking for elements.
browser.visit('/login', function() {
browser.fill('email', 'test1#test.com');
browser.fill('password', 'testtest');
browser.pressButton('Login').then(function() {
browser.assert.success();
}).then(done, done);
});
In this case I should be running the following code on the page the browser is currently on.
<script>
$("#paymentModal").modal('show');
</script>
When running this unit test it gives me the following error.
https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js:3
}return c}function Q(a){var b;for(b in a)if(("data"!==b||!n.isEmptyObject(a[b]))&&"toJSON"!==b)return!1;return!0}function R(a,b,d,e){if(M(a)){var f,g,h=n.expando,i=a.nodeType,j=i?n.cache:a,k=i?a[h]:a[h]&&h;if(k&&j[k]&&(e||j[k].data)||void 0!==d||"string"!=typeof b)return k||(k=i?a[h]=c.pop()||n.guid++:h),j[k]||(j[k]=i?{}:{toJSON:n.noop}),"object"!=typeof b&&"function"!=typeof b||(e?j[k]=n.extend(j[k],b):j[k].data=n.extend(j[k].data,b)),g=j[k],e||(g.data||(g.data={}),g=g.data),void 0!==d&&(g[n.camelCase(b)]=d),"string"==typeof b?(f=g[b],null==f&&(f=g[n.camelCase(b)])):f=g,f}}function S(a,b,c){if(M(a)){var d,e,f=a.nodeType,g=f?n.cache:a,h=f?a[n.expando]:n.expando;if(g[h]){if(b&&(d=c?g[h]:g[h].data)){n.isArray(b)?b=b.concat(n.map(b,n.camelCase)):b in d?b=[b]:(b=n.camelCase(b),b=b in d?[b]:b.split(" ")),e=b.length;while(e--)delete d[b[e]];if(c?!Q(d):!n.isEmptyObject(d))return}(c||(delete g[h].data,Q(g[h])))&&(f?n.cleanData([a],!0):l.deleteExpan
TypeError: j.getClientRects is not a function
at k (https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js:3:26891)
at Object.n.extend.pixelMarginRight (https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js:3:25936)
at a.getComputedStyle.Sa (https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js:3:27592)
at Function.n.extend.css (https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js:3:30895)
at https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js:4:520
at Y (https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js:3:4661)
at n.fn.extend.css (https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js:4:361)
at c.setScrollbar (http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js:6:18612)
at c.show (http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js:6:14692)
at .<anonymous> (http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js:6:13878)
Looks to me like for some reason Zombie.js isn't loading jQuery on that page or there is an error. But in that previous Stack Overflow question and answer at the beginning of the question it looks like Zombie.js can load jQuery.
Are you not able to load jQuery with Zombie.js? How can I fix this? Seems like a very simple thing to test pages with jQuery. Any ideas?
Let me know if you need any additional information or anything. Thanks.
EDIT for some reason when downgrading to jQuery version 1.11.3 it seems to work and the error goes away. Any reason for this?
This bug is fixed : https://github.com/assaf/zombie/issues/1031
Adopting jsdom 8/9 as the fix for your problem was harder than I
wanted. It should be pretty easy to add a dummy implementation for
getClientRects() just to get past that specific failure. I'll try that
and see how it goes
Add a stub implementation of getClientRects() was straightforward. I've published 5.0.1 with a fix for this specific failure.
mdlavin

Javascript snippet not working in Chrome, but works in Internet Explorer

I have a really basic snippet of javascript code that works in Internet Explorer, but not Google Chrome. Here's the line it breaks on:
var formChildren = document.getElementById('myForm').children;
This is the first line in my script. The error I receive is:
cannot read property 'children' of null.
Does anyone know if I'm missing something? I can't imagine why Chrome would error out on such a basic line.
This is part of an MVC 4 project if that makes any difference.
Thank you in advance!
Chrome actually does return null in an instance where it is unable to find an element with that ID. You could hide this error by using (document.getElementById('myForm') || {}).children
My problem is solved. Yes I did some extra testing and realized that I was able to use getElementsByName successfully on both IE and Chrome so I took a look and realized I forgot to add the Id to the form. It was still unexpected that IE knew what it element was without the id set, but the problem is solved.
Thank you Kyle and hackNightly, your input helped a lot in narrowing down my answer.

skrollr mobile clicking on item returns error

I am using the skrollr plugin for parallax https://github.com/Prinzhorn/skrollr. I know it works fine on iPad 3 and iPhone 4S with version 6.1.3.
However, on an iPad 2 version 5.1.1 and several various Android devices, I have run into an issue where if I attempt to click on any link...or really anything at all...I get a message that says:
"JavaScript:Error undefined TypeError:'undefined' is not a function".
I isolated the issue to skrollr.js about line 649 initialElement.click();. If I remove that call, then the error no longer happens...except obviously I still can't click on anything.
Also, I know for sure that this is an error in the plugin itself because I tried clicking on things in the skrollr demo and get the same error http://prinzhorn.github.io/skrollr/.
Has anyone come upon a solution for this? I haven't seen it posted anywhere. Also I've already tried alternatives such as:
initialElement.mousedown('click');
initialElement.trigger('click');
initialElement.bind('click');
initialElement.live('click');
initialElement.delegate('click');
and all give the same exact error.
I find it strange that it doesn't occur in all devices, and the rest of the plugin seems to be working...so it's not an issue on where I'm importing it...heck even everything else attached to initialElement seems to be okay.
Any ideas?
Once again, I would give you a link to my site but can't due to disclosure agreement. But if you need snippets of code let me know.
Thanks for the help!! :)
Maybe give this a shot at line 644 - https://gist.github.com/JustinWUP/6032497
Changing the following on skrollr.js worked for me. [Added $() around the 'initialElement']
if(distance2 < 49) {
//It was a tap, click the element.
//initialElement.focus();
//initialElement.click();
$(initialElement).focus();
$(initialElement).click();
return;
}

Categories

Resources