I'm using a jQuery fork of Wysihat as a Wysiwig editor in a project of mine. It works perfectly in all browsers apart from (surprise, surprise) IE (specifically IE8). I've got the example files uploaded here:
http://pezholio.co.uk/wysihat/examples/custom_buttons.html
When running the file in IE, I get the error Object expected, and it seems to be occurring within this function:
window.getSelection = (function() {
var selection = new Selection(document);
return function() { return selection; };
})();
Any ideas what may be causing the problem, and what I can do to fix it?
Cheers
Ah, OK. I think I've nailed this now. I've removed the existing IE fallback code and am using selection.js instead. You can see the code in the gist below:
https://gist.github.com/2556956
Related
So my example is really basic. Actually not even the basic example from the Timeglider examples is working:
var tg1 = {};
$(function () {
tg1 = $("#placement").timeline({
"icon_folder":"timeglider/icons/",
"data_source":"json/idaho.json"
});
tg_actor = tg1.data("timeline");
tg_actor.zoom(1);
});
It says that tg1.data("timeline")is undefined. Even though there is data in there.
So my issue is that I cannot create an instance of the Timeglider plugin. So I'm not able to use it's functions. Could someone tell me why the data object is always undefined?
Here it is working...
So I found this running example: http://www.avo.alaska.edu/includes/js/timeglider/kitchen_sink.html and here it is working properly. I studied the code and it's nearly the same I have. So what could I have done different?
Working with older jQuery version
http://code.jquery.com/jquery-1.11.2.min.js is working without an error. How can I use the latest jQuery? Even with the migrate plugin I get the same error.
Working with 1.11.2 of jQuery (http://code.jquery.com/jquery-1.11.2.min.js) so it seems like this plugin is just no compatible to the latest version.
This function is not working in IE6 but working in all other browsers. The error is propertyType is undefined and the function does not works for IE6.
My function is,
function propertyType(){}
propertyType.prototype.contactClear=function()
{
$('#error_msg').text('');
$('#error_msg').css("display","none");
$('#name').val(LANG.LBL_NAME+':');
$('#email').val(LANG.LBL_EMAIL+':');
$('#phone').val(LANG.LBL_PHONE+':');
$('#message').val(LANG.LBL_MESSAGE+': '+LANG.LBL_CONTACT_ME);
$("#captchaval").val('');
$("#success_msg").text('');
$('#success_msg').css("display","none");
}
var propertyType = new propertyType();
Can anyone suggest me to solve the issue?
Thanks in advance.
This error may occur if you are attempting to clear or hide the elements before they loaded into the DOM.
Just getting started with Raphael.
Now I'm finding that paper.remove() is generating a script error:
"SCRIPT5009: 'removed' is undefined
Is this a script bug?
My variable paper is initialized thus:
var paper = new Raphael(document.getElementById('canvas_container'), 500, 500);
My HTML body has:
<div id="canvas_container"></div>
This is more info --
I am using Raphael 2.0 which I just downloaded again. Running IE9. Following is the Raphael JS function that is highlighted as the problem:
R.prototype.remove = function () {
eve("remove", this);
this.canvas.parentNode && this.canvas.parentNode.removeChild(this.canvas);
for (var i in this) {
this[i] = removed(i);
}
};
the line ... removed(i) is highlighted --> SCRIPT5009: 'removed' is undefined
BTW I am new to this forum. Is there a way to respond to a thread other than "Answer Your Question"?
I've run across this a couple of times. The line 4443 method as suggested by sudoko-san does work in browsers but not backwards compatible with IE-7 & 8 (the whole point of using raphael).
Another work around is to implement the following code in your javascript:
try{
paper.remove();
}
catch (error) {
// this catches the error and allows you to proceed along nicely
}
That's it!
I don't know if you've supplied enough information to answer this question.
What version of Raphael are you using?
On what browser?
Is it being loaded up correctly - can you create any Raphael objects?
If all you're doing is deleting the paper, see the fiddle below.
JSFiddle
It seems to work fine for me with Raphael 1.5.2
Hope that helps (even slightly).
My problem is that I'm using the CKEditor 3.4 plugin for jQuery, and it's giving me an error in IE 7+8 when executing a $(selector).val(html) call on the editor:
The error:
'this.$.innerHTML' is null or not an object
...which when run in the debugger, points to this line of code in the huge CKEditor.js:
getHtml:function(){var i=this.$.innerHTML;return c?i.replace(/<\?[^>]*>/g,''):i;}
...which translates to this in the source:
getHtml : function()
{
var retval = this.$.innerHTML;
// Strip <?xml:namespace> tags in IE. (#3341).
return CKEDITOR.env.ie ? retval.replace( /<\?[^>]*>/g, '' ) : retval;
},
My offending code (stripped down, but still giving the error):
var editor_data = $("textarea#body").val();
$("textarea#body").val(editor_data);
... and the textarea code for posterity:
<textarea name="body" rows="15" cols="50" class="wysiwyg" id="body"></textarea>
I've tried reproducing in jsFiddle in IE8, but the strange thing is that it works as intended there. I'd love to also provide a working sample but I unfortunately cannot for reasons outside my control.
I've also tried this fix, and it cleared up the error issue, but after that setData did not work as intended and just overwrote the editor contents with nothing. I'll admit this problem+fix is a bit over my head...: http://dev.ckeditor.com/ticket/4566
(Sorry, long post :S) I've also tried to use the direct JavaScript API into CKEditor (abandoning the jQuery integration) and it threw the same error.
Anyone have anything they'd like me to try to fix this issue, or have any hunches of what it might be? It would be much appreciated!
Personally I'm not a fan of the existing answer that consists of modifying the source code because as soon as you update ckEditor, then you have to remember to modify the source yet again. I was having the same problem as the original poster and found a fix that is considered a hack, but totally usable. Simply, a Try/Catch made it all nice and happy in IE8. Now to test in IE7. The other bonus of this fix is that you're not left with blank data when it fails but that you get actual content you were trying to retrieve.
var editor = $('textarea.editor').ckeditorGet();
var vPageContent = "";
try{
vPageContent = editor.getData();//function call fails here
} catch(err){
vPageContent = editor.getData();//but will work here
}
May not be the best solution but take a look at this:
http://dev.ckeditor.com/ticket/4566
It claims that replacing
getHtml:function(){var i=this.$.innerHTML;return c?i.replace(/<\?[^>]*>/g,''):i;},
with
getHtml:function(){return (this.$) ? this.$.innerHTML : "";},
will solve the problem.
I'm not claiming this is the correct answer but I had the same problem today and (for now) it seems to work.
be careful with extra comma. IE does not like exra commas. You can check your code for extra comma with json lint
I'm using jQuery+drupal and some jQuery plugins. All is ok with
Firefox. But in IE's i'm receiving problem like this.
Line: 1
Char: 1
Error: object expected
URL: http://businessway.am
I have included .js files. How to know where is the problem? In which
file? Line 1? Which file?
If you can please check site which I gave before.
You could get this type of errors in case the url of a <script src="...url..."></script> does not return javascript, but some other content (html)
I checked the page, but all scripts with src actually do seem to return javascript. With a bit more digging, it seems that this eval code triggers the error message:
artNoStyleAdding(document)
It looks like it is coming from this script:
<script type="text/javascript">if (Drupal.jsEnabled) {$(document).ready(function(){ window.setTimeout("artNoStyleAdding(document)", 2000);});}</script>
That's the last but one script in the head of the document.
Apperantly you forgot to declare and code the artNoStyleAdding function, whatever it is supposed to do.
I've seen this error come up in IE7 when you have a javascript object with an extra comma on the end.
Example:
var something = {
"one": ["a"],
"two": ["b"],
};
Should be:
var something = {
"one": ["a"],
"two": ["b"]
};
IE8, Chrome, and Firefox don't seem to mind it though.
I had this exact same error, only in IE, when putting comments in a certain spot:
function initMyUI() {
$("#myId") // Don't put comments here.
.delegate("#btnMyButton", "click", _clickDoSomeThings);
};
Depending on your version of IE you'll want to break out the development tools available. You can use Firebug Lite, built in dev tools in IE8 or go the old standby and use Web Developer Express.
The problem has been fixed in IE7 and IE8, but IE6 give's same error.
Updated: Fixed. Sorry :)