onyx.DatePicker breaks in enyo.Repeater - javascript

I am not able to get a onyx.DatePicker working inside a enyo.Repeater. I set up this jsfiddle, which shows my problem. When the // in line 6 is removed, it breaks and shows
Failed to load date time format hash
in my console in Opera Dragonfly.
What is that about, and what to do, to get the onyx.DatePicker working?

Congratulations! You discovered a bug in Enyo. It turns out the onSetupItem handler in DatePicker.js isn't returning a truthy value so the event bubbles up to your Repeater. I have filed a bug (ENYO-2059) and will push a fix up afterwards.
If you want to fix it for yourself go into DatePicker.js and add 'return true;' to the end of setupYear().
As to your 'cannot load date time hash' issue, I suspect it's because you haven't included the g11n library. I'm not sure I've seen that message before but it would be a non-fatal error and Enyo will default to English.

Related

Uncaught TypeError: Cannot call method 'toLowerCase' of undefined using Ckeditor

I am trying to filter words(ants,words) using ckeditor.This works fine with normal textarea. http://jsfiddle.net/fqthJ/22/ .Now I am trying it with ckeditor http://jsfiddle.net/s47M3/35/ but I get the following error
Uncaught TypeError: Cannot call method 'toLowerCase' of undefined using Ckeditor
If you check on the console ,I get the above error only once I type the filtered words(ants and words) otherwise no error comes.
Please help
Actually I have been trying to solve a same type of question yesterday that you have posted.
The problem is you can't use jQuery long with CKEDITOR and therefore you faced the error.
FIX:
alert("The following word/words "+
CKEDITOR.instances['editor1'].getData().match(regAry[index])+" is banned");
JSFiddle
If you're interested with jQuery Adaptor of CKEditor, then you can go with your own.
In the second fiddle, try putting a debugger; line just before alert('the following words... and then open up your browsers developer console before running it again. You'll notice that the $(this) is a CKEditor specific dom element that looks like an iFrame so .val() will probably fail, because it looks for strings. I don't know enough about CKEditor to figure out how to get editor content out of it, but know that it is html formatted if you browse around in the CKEditor.dom.element, so it will contain html elements in addition to ordinary text etc.

JQuery selector not working intermittently

I am writing a crawler which goes through pages if it detects a ">" type button on current page. Code fails about 1 time out of 100 with error "Uncaught TypeError: Cannot read property 'innerText' of undefined". In attempt to troubleshoot I open Chrome's developer console and test the selector on that specific page manually. It always returns what I expect and the button is visually there. I am puzzled why it fails only rarely and at the same time page where it fails looks normal. Any suggestions how to isolate the problem?
Code:
lastButton = $(".button a").last()[0];
if(lastButton.innerText === ">") {
next(lastButton.href, "getFriends", id);
}
At what point does your crawler run that selector? If the page isn't completely finished rendering yet, because the DOM isn't ready, or the code on the page maybe hasn't finished building out the page, your call to $(".button a").last() would return an empty array. Since you can access any index off that empty array still, when you try to grab the first item out of it you'll get undefined, which would then result in an error when you try to call .innerText off of it.
Try logging how many items are being returned by the selector to see if that is the case.
Found that code in question actually works fine 100% of time. The problem is somehow related to my crawler executing a different scrape function without loading the page for that function. So the peculiar intermittent problem is somewhere else.
Thank you for all who tried to help!

FancyBox Jquery Null Error - Strange issue

I am experiencing a very strange issue i am hoping someone can answer (its kind of broad, but i will explain it my best), code works on local page when opened, but as soon as the same page is uploaded it throws an error. Two others have also looked at this, resulting in more confusion.
I downloaded FancyBox to use the inline feature to pop up a user form via href link, instead of taking the user to an additional page.
You can see the "stock" fancy box here:
1 fancyapps.com/fancybox/demo
Under various options, Inline is what i am using.
I didnt need all of the other features that came with FancyBox so i stripped the page to the following, which works just fine:
2 *Fancy Box Demo Stripped to Inline Feature only*
So then, i applied this code to our sandbox copy of the page to implement:
3 *Sandbox Copy with Fancy Box inline feature added to "make offer" link*
It stops working! There are no conflicts with other javascript on the page, and the only difference is that it has a couple of color .css changes, all .fancybox was named to .ptroffer and that the css code is not inline on the page (which wouldn't cause this error anyway).
This same page, opened locally works beautifully - upload and it throws error.
SCRIPT5007: Unable to get value of the property 'ptroffer': object is null or undefined
<script type="text/javascript">
$(document).ready(function() {
$('.ptroffer').ptroffer();
});
</script>
Works fine with link #2, and with link #3 locally, but with #3 uploaded it throws error.
Please!
Something in your code somewhere is overriding $. If you change that "ready" handler to call
jQuery('.ptroffer').ptroffer();
you won't get that error. However, things may not work; I think that an older version of jQuery is being imported by something (1.3!), which is bad.
edit oh I see, something's pulling in Prototype. You've got a regular script soup going on there, and things are going to be unpredictable and bizarre until you get that straightened out. Probably somewhere in there something's calling jQuery.noConflict(), but that "ready" handler you're adding isn't written to expect that. Whatever code that's expecting jQuery 1.3 may be in for a surprise also.

CKEditor JavaScript error on IE8

I am using CKEditor version 3.6.1.
There is an error on IE8 when I put an empty row by "enter."
Here is an example:
writting test
writing test2
As you can see, there is an empty line between two sentences. When I click the empty row by mouse, I could not focus it to write something. To focus the empty row to write, I need to use my keyboard. Someone told me it's a JavaScript error on IE8. When I debugged it, I saw an error message like setSize == undefined. Does anyone know about this?
In addition, it's to hard to upgrade the CKEditor version, because I customized many codes.
It's impossible to help you if you use old version of CKEditor, you have modified it and you haven't provided us any idea what you have changed and what error and where do you have.

Best way to locate source of Warning: Empty string passed to getElementById()

Warning: Empty string passed to getElementById().
Source File: chrome://browser/content/browser.xul
Line: 0
Some days ago I started getting the above message while developing my site. Things are working as they should (or at least I think they are), but I want to find out where this is coming from. I use jQuery so do not use getElementById() directly. Plus I have Firebug and the Web Developer extension for Firefox running.
I could laboriously put in code to check for an empty string being given to a jQuery selection or maybe look into jQuery itself, but my skills are minimal, so I'm asking here if anyone has offhand a good idea for quickly locating the source of the warning messages.
Source File: chrome://browser/content/browser.xul
This means that the error is in a Firefox extension, not in your code.
Was receiving this warning in Firefox.
I just came across this warning and found that there were labels for input fields but the labels for attribute was not set/empty so just completing the for attribute fixed this issue for me.
// Label's for attribute not set which caused the warning in FF
e.g. <label for=''>Text</label><input type="text" name="text" id="text" value="" />
If you are querying by '#' selector -- ensure the selector is unique (as it should be) or you will end up with this error in ff
In my case this was caused by Firefox performing HTML5 checks on the input fields on my form.
Once the "required" property was removed from the form elements everything seemed to work fine again.
This was something brought about by the MVC framework I use which generates these properties based on the model validation rules that require a field to be non-empty.
This answer was really helpful to me in finding why it was happening so I decided to share.
I've placed the following code OUTSIDE document.ready and got this error.
// Enable Line Items ONLY AFTER general info is filled out!
$( "#client_estimate_continue_next" ).click(function(e) {
//e.preventDefault();
console.log(this.id + ' click event fired.');
// DO SOMETHING...
});
I was able to fix the error by simply placing it INSIDE document.ready
Additional info:
I got the error but in my case it was coming from my own script according to FireFox.
I believe I got the error because I made a reference to the id of an element that was not yet fully rendered eg. NOT ready.
Warning: Empty string passed to getElementById().

Categories

Resources