Hi all,
I've been running into an intermittent Javascript error in Firefox that I'm having trouble pinning down. "elementRegion.contains is not a function" It happens intermittently when interacting with the form, usually after changing a value in the form. Has anybody else run across this and have a solution? |
Upon further investigation, the error is being thrown when hovering over a validation error message. It looks to be coming from this bit in YUI (container.js):
preventOverlap: function (pageX, pageY) { var height = this.element.offsetHeight, mousePoint = new YAHOO.util.Point(pageX, pageY), elementRegion = Dom.getRegion(this.element); elementRegion.top -= 5; elementRegion.left -= 5; elementRegion.right += 5; elementRegion.bottom += 5; if (elementRegion.contains(mousePoint)) { this.cfg.setProperty("y", (pageY - height - 5)); } } Sticking an alert(elementRegion); directly before the if check spits out "false". |
Administrator
|
Over time, we fixed a few "small" issues that fall in this category.
Often, if we're not very careful, we get in a situation where a tooltip is displayed, a function is registered to, say, hide the tooltip after a certain delay, but in the meantime the tooltip was hidden by some other code, and when that function runs, it fails, as it can't find the tooltip or some related object. Would you be able to test if you can still reproduce this with a nightly build? If you can, could you create a stand-alone example that we can run here to reproduce this? Alex On Tue, Jan 3, 2012 at 8:49 AM, Kaex <[hidden email]> wrote: > Upon further investigation, the error is being thrown when hovering over a > validation error message. It looks to be coming from this bit in YUI > (container.js): > > preventOverlap: function (pageX, pageY) { > > var height = this.element.offsetHeight, > mousePoint = new YAHOO.util.Point(pageX, pageY), > elementRegion = Dom.getRegion(this.element); > > elementRegion.top -= 5; > elementRegion.left -= 5; > elementRegion.right += 5; > elementRegion.bottom += 5; > > > if (elementRegion.contains(mousePoint)) { > this.cfg.setProperty("y", (pageY - height - 5)); > } > } > > Sticking an alert(elementRegion); directly before the if check spits out > "false". > > > -- > View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/Intermittent-Javascript-Error-Firefox-tp4246836p4257568.html > Sent from the Orbeon Forms (ops-users) mailing list archive at Nabble.com. > > > -- > You receive this message as a subscriber of the [hidden email] mailing list. > To unsubscribe: mailto:[hidden email] > For general help: mailto:[hidden email]?subject=help > OW2 mailing lists service home page: http://www.ow2.org/wws > -- Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
Thanks for the response Alessandro. I had noticed this with a nightly build I grabbed ~Dec 11th.
I will update to the latest nightly build and report what I find. |
Ok, I've tested the latest nightly build and the Javascript error still exists in my form in Firefox, but not in any of the stock forms in Form Runner. I'm starting to think that this may be a result of how I load the form.
I'm currently running using the separate deployment strategy and loading the form via the Ajax portlet technique (even though it's not officially supported ;) ). Here is the Javascript I use to load the form: jQuery(document).ready(function() { var initOrbeon = function() { // initialize Orbeon only in Firefox if (typeof ORBEON != "undefined") { if (!document.all) { ORBEON.xforms.Init.document(); } } }; jQuery("#form").load("form", initOrbeon); }); I've got these properties set in my properties-local.xml: <property as="xs:boolean" name="oxf.epilogue.embeddable" value="true" /> <property as="xs:boolean" name="oxf.xforms.ajax-portlet" value="true"/> <property as="xs:anyURI" name="oxf.epilogue.theme.embeddable" value="oxf:/config/theme-embeddable.xsl"/> I've also attached the oxf.epilogue.theme.embeddable XSL that I use. Am I missing anything? theme-embeddable.xsl |
I've figured it out after digging through the Javascript and playing around. What I found was that it works when I explicitly dispatch the Yahoo DOMReadyEvent instead of calling ORBEON.xforms.Init.document() when loading the form.
I.E. jQuery(document).ready(function() { var initOrbeon = function() { // initialize Orbeon only in Firefox if (typeof ORBEON != "undefined") { if (!document.all) { YAHOO.util.Event.DOMReadyEvent.fire(); } } }; jQuery("#form").load("form", initOrbeon); }); This probably isn't future-proof, but it works for now. :) |
Administrator
|
On Fri, Jan 20, 2012 at 2:48 PM, Kaex <[hidden email]> wrote:
> I've figured it out after digging through the Javascript and playing around. > What I found was that it works when I explicitly dispatch the Yahoo > DOMReadyEvent instead of calling ORBEON.xforms.Init.document() when loading > the form. Good find. I am not sure if this is the reason, but we have more and more code which initializes different part of the UI and which isn't in the humongous xforms.js, and thus listens directly on the DOMReadyEvent. So firing a DOMReadyEvent is more future-proof (and, as you found, even present-proof!) than calling ORBEON.xforms.Init.document(). Thank you for sharing this here. Alex -- Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
Free forum by Nabble | Edit this page |