How CustomEvent.observe works?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2015 02:03 PM
Hello--
I was reviewing one OoB code which resizes the iFrame's size based on user's interaction. The code is something like below
<script>
(function() {
CustomEvent.observe('content_frame.resized', contentFrameResized);
CustomEvent.observe('content_frame.loaded', contentFrameResized);
var isFirefox = navigator.userAgent.indexOf('Firefox') > -1;
function contentFrameResized(name, height) {
if (!name)
return;
var f = $(name);
if (!f)
return;
// avoid using an AND here
if (!isFirefox || height == 10)
_resize(f, height);
else {
// delay resize for firefox
setTimeout(function() {
_resize(f, height);
}, 0);
}
}
function _resize(f, height) {
f.height = height;
}
})();
</script>
I am curios to understand how "content_frame.resized" is attached to the iFrames.
Any pointer would be helpful.
Regards,
Sudipta
- Labels:
-
User Interface (UI)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2015 02:09 PM
It gets fired from the ui_page_footer ui macro that runs inside of the iframe.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-29-2015 10:45 AM
Thanks Brad.
Could you please also let me know where the event "content_frame.resized" is defined.
Regards,
Sudipta

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-29-2015 11:13 AM
It gets fired from that same ui macro. In a new fuji instance it's on line 29:
window.parent.CustomEvent.fire('content_frame.resized', self.name, pageHeight);