Search Results

Search found 437 results on 18 pages for 'listeners'.

Page 2/18 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Javascript: Controlling the order that event handlers / listeners are exeucted in

    - by LRE
    Once again the IE Monster has hit me with an odd problem. I'm writing some changes into an asp.net site I inherited a while back. One of the problems is that in some pages there are several controls that add javascript functions as handlers to the onload event (using YUI if that matters). Some of those event handlers assume certain other functions have been executed. This is well and good in Firefox and IE7 as the handlers seem to execute in order of registration. IE8 on the other hand does this backwards. I could go with some kind of double-checking approach but given the controls are present in several pages I feel that'd create even more dependencies. So I've started cooking up my own queue class that I push the functions to and can control their execution order. Then I'll register an onload handler that instructs the queue to execute in my preferred order. I'm part way through that and have started wondering 2 things: Am I going OTT? Am I reinventing the wheel? Anyone have any insights? Any clean solutions that allow me to easily enforce execution order?

    Read the article

  • Flash AS3 Coloring Book - Movieclip only clickable in certain spots (Event Listeners)

    - by kilrizzy
    I am working on a coloring book and have a movieclip (outlines) containing many movieclips that can be changed to whatever color the user has selected. However it seems like some of the movieclips can be clicked anywhere and work great, and others you need to click a certain spot for it to color in. I have an example here: http://jeffkilroy.com/hosted/softee/coloring.html Notice the three sections of the icecream (top, middle, bottom). The middle is clickable from anywhere inside the movieclip, however the top and especially bottom require you to click on specific spots in order for you to activate the event listener. Not sure if it is a depth issue because I would assume if that is the case it would activate at least a different movieclip but it just seems nothing happens at all. Any help would be appreciated, I also have the source located here: Source CS4 Source CS3

    Read the article

  • Listeners when using hylafax from Java

    - by DaDaDom
    I am trying to send a fax to a hylafax server via Java: Client faxClient = new HylaFAXClient(); faxClient.open(...); faxClient.user(...); faxClient.pass(...); Job j = faxClient.createJob(); job.setStuff(...); job.setNotifyType(Job.NOTIFY_ALL); faxClient.addTransferListener(new FaxTransferListener()); faxClient.addConnectionListiener(new FaxConnectionListener()); faxClient.submit(job); The problem is that I don't get any notifications on any of the listener methods. When I watch the queues on the hylafax server, e.g. via JHylaFax, the job failed, but how can I react to that event programatically on client side without having to poll the job queues regularly?

    Read the article

  • assigning variables to DOM event listeners when iterating

    - by ptrn
    I'm thinking there's something basic stuff I'm missing here; for (var i=1; i<=5; i++) { var o = $('#asd'+i); o.mouseover(function() { console.info(i); }); } When hovering over the five different elements, I always get out the last value from iteration; the value 5. What I want is different values depending of which element I'm hovering, all from 1 to 5. What am I doing wrong here?

    Read the article

  • Beginning with event listeners

    - by terence6
    I have a simple app, showing picture made of tiled images(named u1, u2,...,u16.jpg). Now I'd like to add some Events to it, so that I can show these images only when proper button is clicked. I've tried doing it on my own, but it's not working. Where am I doing something wrong? Original code : import java.awt.GridLayout; import javax.swing.*; import javax.swing.border.BevelBorder; public class Tiles_2 { public static void main(String[] args) { final JFrame f = new JFrame("Usmiech"); JPanel panel = new JPanel(new GridLayout(4, 4, 3, 3)); JLabel l = new JLabel(); for (int i = 1; i < 17; i++) { String path = "u"+ i+".jpg"; l = new JLabel(new ImageIcon(path)); l.setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED)); panel.add(l); } f.setContentPane(panel); f.setSize(300, 300); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setVisible(true); } } New code : import java.awt.GridLayout; import javax.swing.*; import javax.swing.border.BevelBorder; import java.awt.event.*; public class Zad_8_1 implements ActionListener { public void actionPerformed(ActionEvent e) { JButton b = (JButton)(e.getSource()); String i = b.getText(); b = new JButton(new ImageIcon("u"+i+".jpg")); } public static void main(String[] args) { final JFrame f = new JFrame("Smile"); JPanel panel = new JPanel(new GridLayout(4, 4, 3, 3)); JButton l = null; for (int i = 1; i < 17; i++) { String path = "u"+ i+".jpg"; l = new JButton(""+i); l.setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED)); l.setSize(53,53); panel.add(l); } f.setContentPane(panel); f.setSize(300, 300); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setVisible(true); } } This should work like this : http://img535.imageshack.us/img535/3129/lab8a.jpg

    Read the article

  • Hibernate updating records and implementing listeners : getting only required attribute values for event.getOldState()

    - by Narendra
    Hi All, I am using Hibernate 3 as my persistence framework. Below is the sample hbm file I am using. <?xml version="1.0"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> <hibernate-mapping> <class name="com.test.User" table="user"> <meta attribute="implements">com.test.dao.interfaces.IEntity</meta> <id name="key" type="long" column="user_key"> <generator class="increment" /> </id> <property name="userName" column="user_name" not-null="true" type="string" /> <property name="password" column="password" not-null="true" type="string" /> <property name="firstName" column="first_name" not-null="true" type="string" /> <property name="lastName" column="last_name" not-null="true" type="string" /> <property name="createdDate" column="created_date" not-null="true" type="timestamp" insert="false" update="false" /> <property name="createdBy" column="created_by" not-null="true" type="string" update="false" /> </class> </hibernate-mapping> I am added a post-update listener. What it will do is if there any updations perfomed on User then it will be invoked and cahnges will be inserted to audit table. Below is the sample implementation for postupdate event. public void onPostUpdate(PostUpdateEvent event) { LogHelper.info(logger, "Begin - onPostUpdate " + event.getEntity().getClass().getSimpleName()); if (!this.checkForAudit(event.getEntity().getClass().getSimpleName())) { // check do we need to audit it. } // Get Attribute Names String[] attrNames = event.getPersister().getEntityMetamodel() .getPropertyNames(); Object[] oldobjectValue = c Object[] newObjectValue = event.getState(); this.auditDetailsEvent(attrNames, oldobjectValue, newObjectValue); LogHelper.info(logger, "End - onPostUpdate"); // return false; } Here is my requirement. event.getPersister().getEntityMetamodel() .getPropertyNames(); or event.getOldState(); or event.getState(); must return attribute names or value which i can update or insert. Is there any way to control the return values of above one's. Pleas help me on this regard. Thanks, Narendra

    Read the article

  • Trouble adding event listeners via JavaScript

    - by Jack Roscoe
    Currently I have a function which loops to create multiple HTML objects. Each time an object is created, I want to add an onClick function listener to that object so that I can trigger a function when each one is clicked. What's the best way to do this? Here's the code which creates my objects: RenderMultipleChoice:function() { this.c = paper.rect(this.x, this.y, this.shapeWidth, this.shapeHeight); }

    Read the article

  • java Swing Listeners: components listening at each others.

    - by Pierre
    Hi all, I want to code two JList (categories and items). When I click one category it should select all the items for that category and when I click on one item it should select its categories. So both JList will have a ListSelectionListener listening at each other and changing the selection. Should I fear about some a of "loop" ? Is there a way to tell that an Event has been consumed ? how do people manage that kind of situation ? Thanks

    Read the article

  • windows keydown listeners in C

    - by numerical25
    I am having a very hard time finding resources that talk about the windows message system. Mainly the keydown constant variables. I need to know what const varibles I need to listen for all keypress especially the arrow keys for C

    Read the article

  • Jquery UI Dialog Event Listeners not working

    - by flaiks
    I have a page, which upon clicking a specific link a jquery ui dialog is opened, works perfectly, in said dialog there is a form(a user registration form), and I need to attach a submit event handler on that form, but because it is loaded with ajax in jquery the event handler will NOT attach, my code is such as this: $("#register").on("submit", false); I just need to be able to cancel the form submission within the dialog and i cannot get it to work.

    Read the article

  • Async run for javascript by using listeners

    - by CharlieShi
    I have two functions, the names are Function3, Function4, Function3 will send request to server side to get jsondata by using ajax, which, however, will take about 3 seconds to complete. Function4 is a common function which will wait for Function3's result and then action. My code puts below: function ajaxRequest(container) { $.ajax({ url: "Home/GetResult", type: "post", success: function (data) { container.append(data.message); } }); } var eventable = { on: function (event, cb) { $(this).on(event, cb); }, trigger: function (event) { $(this).trigger(event); } } var Function3 = { run: function () { var self = this; setTimeout(function () { ajaxRequest($(".container1")); self.trigger('done'); }, 500); } } var Function4 = { run: function () { var self = this; setTimeout(function () { $(".container1").append("Function4 complete"); self.trigger('done'); },500); } } $.extend(Function3, eventable); $.extend(Function4, eventable); Function3.on('done', function (event) { Function4.run(); }); Function4.on('done', function () { $(".container1").append("All done"); }); Function3.run(); but now the problem is, when I start the code , it always show me the result as : first will appear "Function4 complete", then "All done" follows, 3 seconds later, "Function3 complete" will appear. That's out of my expection because my expection is "Function3 complete" comes first, "Function4 complete" comes second and "All done" is expected as the last one. Anyone can help me on this? thx in advice. EDIT: I have included all the functions above now. Also, you can check the js script in JSFIDDER: http://jsfiddle.net/sporto/FYBjc/light/ I have replaced the function in JSFIDDER from a common array push action to ajax request.

    Read the article

  • How can I filter images and use filesystemview icons in my jtree?

    - by HoLeX
    First of all sorry about my english. So, i have some problems with my JTree because i want to filter specific types of images and also i want to use icons of FileSystemView class. Can you help me? I will appreciate so much. Here is my code: import java.awt.BorderLayout; import java.io.File; import java.util.Iterator; import java.util.Vector; import javax.swing.JPanel; import javax.swing.JTree; import javax.swing.event.TreeModelEvent; import javax.swing.event.TreeModelListener; import javax.swing.event.TreeSelectionEvent; import javax.swing.event.TreeSelectionListener; import javax.swing.tree.TreeModel; import javax.swing.tree.TreePath; public class ArbolDirectorio extends JPanel { private JTree fileTree; private FileSystemModel fileSystemModel; public ArbolDirectorio(String directory) { this.setLayout(new BorderLayout()); this.fileSystemModel = new FileSystemModel(new File(directory)); this.fileTree = new JTree(fileSystemModel); this.fileTree.setEditable(true); this.fileTree.addTreeSelectionListener(new TreeSelectionListener() { @Override public void valueChanged(TreeSelectionEvent event) { File file = (File) fileTree.getLastSelectedPathComponent(); System.out.println(getFileDetails(file)); } }); this.add(fileTree, BorderLayout.CENTER); } private String getFileDetails(File file) { if (file == null) { return ""; } StringBuffer buffer = new StringBuffer(); buffer.append("Name: " + file.getName() + "\n"); buffer.append("Path: " + file.getPath() + "\n"); return buffer.toString(); } } class FileSystemModel implements TreeModel { private File root; private Vector listeners = new Vector(); public FileSystemModel(File rootDirectory) { root = rootDirectory; } @Override public Object getRoot() { return root; } @Override public Object getChild(Object parent, int index) { File directory = (File) parent; String[] children = directory.list(); return new TreeFile(directory, children[index]); } @Override public int getChildCount(Object parent) { File file = (File) parent; if (file.isDirectory()) { String[] fileList = file.list(); if (fileList != null) { return file.list().length; } } return 0; } @Override public boolean isLeaf(Object node) { File file = (File) node; return file.isFile(); } @Override public int getIndexOfChild(Object parent, Object child) { File directory = (File) parent; File file = (File) child; String[] children = directory.list(); for (int i = 0; i < children.length; i++) { if (file.getName().equals(children[i])) { return i; } } return -1; } @Override public void valueForPathChanged(TreePath path, Object value) { File oldFile = (File) path.getLastPathComponent(); String fileParentPath = oldFile.getParent(); String newFileName = (String) value; File targetFile = new File(fileParentPath, newFileName); oldFile.renameTo(targetFile); File parent = new File(fileParentPath); int[] changedChildrenIndices = { getIndexOfChild(parent, targetFile) }; Object[] changedChildren = { targetFile }; fireTreeNodesChanged(path.getParentPath(), changedChildrenIndices, changedChildren); } private void fireTreeNodesChanged(TreePath parentPath, int[] indices, Object[] children) { TreeModelEvent event = new TreeModelEvent(this, parentPath, indices, children); Iterator iterator = listeners.iterator(); TreeModelListener listener = null; while (iterator.hasNext()) { listener = (TreeModelListener) iterator.next(); listener.treeNodesChanged(event); } } @Override public void addTreeModelListener(TreeModelListener listener) { listeners.add(listener); } @Override public void removeTreeModelListener(TreeModelListener listener) { listeners.remove(listener); } private class TreeFile extends File { public TreeFile(File parent, String child) { super(parent, child); } @Override public String toString() { return getName(); } } }

    Read the article

  • Why are my event listeners firing more than once?

    - by Arms
    In my Flash project I have a movieclip that has 2 keyframes. Both frames contain 1 movieclip each. frame 1 - Landing frame 2 - Game The flow of the application is simple: User arrives on landing page (frame 1) User clicks "start game" button User is brought to the game page (frame 2) When the game is over, the user can press a "play again" button which brings them back to step 1 Both Landing and Game movieclips are linked to separate classes that define event listeners. The problem is that when I end up back at step 1 after playing the game, the Game event listeners fire twice for their respective event. And if I go through the process a third time, the event listeners fire three times for every event. This keeps happening, so if I loop through the application flow 7 times, the event listeners fire seven times. I don't understand why this is happening because on frame 1, the Game movieclip (and I would assume its related class instance) does not exist - but I'm clearly missing something here. I've run into this problem in other projects too, and tried fixing it by first checking if the event listeners existed and only defining them if they didn't, but I ended up with unexpected results that didn't really solve the problem. I need to ensure that the event listeners only fire once. Any advice & insight would be greatly appreciated, thanks!

    Read the article

  • Concurrency with listeners and upload: is this solution sound?

    - by cbrulak
    I'm working on an Android app. We have listeners for position data and camera capture which is timed on a background thread (not a service). The timer thread dictates when the image is captured and also when the data is cached in a local sqlite db. So, my question is how to properly store the location data as it comes in based on the listeners and pull that data so that the database can be updated as the camera capture is executed. I can't put the location data into the database as it arrives because it is processed more frequently than the camera images and the camera images are what dominates the architecture at the moment. (Location data is supplement). However I need the location data to get a rough location of the where the image is captured. My first thought was to have singleton store the location data. And have a semaphore on the getInstance method so if the database update is happening (after an image is captured) we don't have an error. The location data can wait for the database update or it can be lost for that particular event it doesn't really matter. What are you thoughts? Am I on the right track? (And is this the right sub-site or would this be better on stackoverflow?)

    Read the article

  • API For Flex Apps To Interact

    - by dimo414
    I have a large flex application (the app) running on one server, and many small flex applications (widgets) running on another server, which are to be included in the app so that visually the user see's one continuous application. Due to proprietary third party software, this structure cannot be changed. I am looking for some way to allow the app and the widgets to communicate, allowing the app to make changes to the widgets and the the widgets to notify the app when events are triggered, so that user interaction is fluid and continuous. There are a few related questions which indicate it's possible to do this by setting up event triggers and listeners. I am wondering if there is any standardized way to do this (the answers aren't very clear) or if anyone has developed a library or API to make this easier.

    Read the article

  • Add objects to association in OnPreInsert, OnPreUpdate

    - by Dmitriy Nagirnyak
    Hi, I have an event listener (for Audit Logs) which needs to append audit log entries to the association of the object: public Company : IAuditable { // Other stuff removed for bravety IAuditLog IAuditable.CreateEntry() { var entry = new CompanyAudit(); this.auditLogs.Add(entry); return entry; } public virtual IEnumerable<CompanyAudit> AuditLogs { get { return this.auditLogs } } } The AuditLogs collection is mapped with cascading: public class CompanyMap : ClassMap<Company> { public CompanyMap() { // Id and others removed fro bravety HasMany(x => x.AuditLogs).AsSet() .LazyLoad() .Access.ReadOnlyPropertyThroughCamelCaseField() .Cascade.All(); } } And the listener just asks the auditable object to create log entries so it can update them: internal class AuditEventListener : IPreInsertEventListener, IPreUpdateEventListener { public bool OnPreUpdate(PreUpdateEvent ev) { var audit = ev.Entity as IAuditable; if (audit == null) return false; Log(audit); return false; } public bool OnPreInsert(PreInsertEvent ev) { var audit = ev.Entity as IAuditable; if (audit == null) return false; Log(audit); return false; } private static void LogProperty(IAuditable auditable) { var entry = auditable.CreateAuditEntry(); entry.CreatedAt = DateTime.Now; entry.Who = GetCurrentUser(); // Might potentially execute a query. // Also other information is set for entry here } } The problem with it though is that it throws TransientObjectException when commiting the transaction: NHibernate.TransientObjectException : object references an unsaved transient instance - save the transient instance before flushing. Type: CompanyAudit, Entity: CompanyAudit at NHibernate.Engine.ForeignKeys.GetEntityIdentifierIfNotUnsaved(String entityName, Object entity, ISessionImplementor session) at NHibernate.Type.EntityType.GetIdentifier(Object value, ISessionImplementor session) at NHibernate.Type.ManyToOneType.NullSafeSet(IDbCommand st, Object value, Int32 index, Boolean[] settable, ISessionImplementor session) at NHibernate.Persister.Collection.AbstractCollectionPersister.WriteElement(IDbCommand st, Object elt, Int32 i, ISessionImplementor session) at NHibernate.Persister.Collection.AbstractCollectionPersister.PerformInsert(Object ownerId, IPersistentCollection collection, IExpectation expectation, Object entry, Int32 index, Boolean useBatch, Boolean callable, ISessionImplementor session) at NHibernate.Persister.Collection.AbstractCollectionPersister.Recreate(IPersistentCollection collection, Object id, ISessionImplementor session) at NHibernate.Action.CollectionRecreateAction.Execute() at NHibernate.Engine.ActionQueue.Execute(IExecutable executable) at NHibernate.Engine.ActionQueue.ExecuteActions(IList list) at NHibernate.Engine.ActionQueue.ExecuteActions() at NHibernate.Event.Default.AbstractFlushingEventListener.PerformExecutions(IEventSource session) at NHibernate.Event.Default.DefaultFlushEventListener.OnFlush(FlushEvent event) at NHibernate.Impl.SessionImpl.Flush() at NHibernate.Transaction.AdoTransaction.Commit() As the cascading is set to All I expected NH to handle this. I also tried to modify the collection using state but pretty much the same happens. So the question is what is the last chance to modify object's associations before it gets saved? Thanks, Dmitriy.

    Read the article

  • How to add objects to association in OnPreInsert, OnPreUpdate

    - by Dmitriy Nagirnyak
    Hi, I have an event listener (for Audit Logs) which needs to append audit log entries to the association of the object: public Company : IAuditable { // Other stuff removed for bravety IAuditLog IAuditable.CreateEntry() { var entry = new CompanyAudit(); this.auditLogs.Add(entry); return entry; } public virtual IEnumerable<CompanyAudit> AuditLogs { get { return this.auditLogs } } } The AuditLogs collection is mapped with cascading: public class CompanyMap : ClassMap<Company> { public CompanyMap() { // Id and others removed fro bravety HasMany(x => x.AuditLogs).AsSet() .LazyLoad() .Access.ReadOnlyPropertyThroughCamelCaseField() .Cascade.All(); } } And the listener just asks the auditable object to create log entries so it can update them: internal class AuditEventListener : IPreInsertEventListener, IPreUpdateEventListener { public bool OnPreUpdate(PreUpdateEvent ev) { var audit = ev.Entity as IAuditable; if (audit == null) return false; Log(audit); return false; } public bool OnPreInsert(PreInsertEvent ev) { var audit = ev.Entity as IAuditable; if (audit == null) return false; Log(audit); return false; } private static void LogProperty(IAuditable auditable) { var entry = auditable.CreateAuditEntry(); entry.CreatedAt = DateTime.Now; entry.Who = GetCurrentUser(); // Might potentially execute a query. // Also other information is set for entry here } } The problem with it though is that it throws TransientObjectException when commiting the transaction: NHibernate.TransientObjectException : object references an unsaved transient instance - save the transient instance before flushing. Type: PropConnect.Model.UserAuditLog, Entity: PropConnect.Model.UserAuditLog at NHibernate.Engine.ForeignKeys.GetEntityIdentifierIfNotUnsaved(String entityName, Object entity, ISessionImplementor session) at NHibernate.Type.EntityType.GetIdentifier(Object value, ISessionImplementor session) at NHibernate.Type.ManyToOneType.NullSafeSet(IDbCommand st, Object value, Int32 index, Boolean[] settable, ISessionImplementor session) at NHibernate.Persister.Collection.AbstractCollectionPersister.WriteElement(IDbCommand st, Object elt, Int32 i, ISessionImplementor session) at NHibernate.Persister.Collection.AbstractCollectionPersister.PerformInsert(Object ownerId, IPersistentCollection collection, IExpectation expectation, Object entry, Int32 index, Boolean useBatch, Boolean callable, ISessionImplementor session) at NHibernate.Persister.Collection.AbstractCollectionPersister.Recreate(IPersistentCollection collection, Object id, ISessionImplementor session) at NHibernate.Action.CollectionRecreateAction.Execute() at NHibernate.Engine.ActionQueue.Execute(IExecutable executable) at NHibernate.Engine.ActionQueue.ExecuteActions(IList list) at NHibernate.Engine.ActionQueue.ExecuteActions() at NHibernate.Event.Default.AbstractFlushingEventListener.PerformExecutions(IEventSource session) at NHibernate.Event.Default.DefaultFlushEventListener.OnFlush(FlushEvent event) at NHibernate.Impl.SessionImpl.Flush() at NHibernate.Transaction.AdoTransaction.Commit() As the cascading is set to All I expected NH to handle this. I also tried to modify the collection using state but pretty much the same happens. So the question is what is the last chance to modify object's associations before it gets saved? Thanks, Dmitriy.

    Read the article

  • Object can not be resolved.

    - by Gabriel A. Zorrilla
    I have this code: public class Window extends JFrame { public Window(){ ... JButton button = new JButton("OK"); getContentPane().add(button); ButtonHandler handler = new ButtonHandler(); button.addActionListener(handler); ... } private class ButtonHandler implements ActionListener { public void actionPerformed(ActionEvent event){ if (event.getSource() == button){ // <--- "button can not be resolved" System.out.println("Hello"); } } } I'm getting that error in Eclipse. I just made a (simplified) example found in a book, dont know what can be wrong. Knowledge eye required! :)

    Read the article

  • NHibernate listener/event to replace object before insert/update

    - by vIceBerg
    Hi! I have a Company class which have a collection of Address. Here's my Address class:(written top of my head): public class Address { public string Civic; public string Street; public City City; } This is the City class: public class City { public int Id; public string Name; public string SearchableName{ get { //code } } } Address is persisted in his own table and have a reference to the city's ID. City are also persisted in is own table. The City's SearchableName is used to prevent some mistakes in the city the user type. For example, if the city name is "Montréal", the searchable name will be "montreal". If the city name is "St. John", the searchable name will be "stjohn", etc. It's used mainly to to search and to prevent having multiple cities with a typo in it. When I save an address, I want an listener/event to check if the city is already in the database. If so, cancel the insert and replace the user's city with the database one. I would like the same behavior with updates. I tried this: public bool OnPreInsert(PreInsertEvent @event) { City entity = (@event.Entity as City); if (entity != null) { if (entity.Id == 0) { var city = (from c in @event.Session.Linq<City>() where c.SearchableName == entity.SearchableName select c).SingleOrDefault(); if (city != null) { //don't know what to do here return true; } } } return false; } But if there's already a City in the database, I don't know what to do. @event.Entity is readonly, if I set @event.Entity.Id, I get an "null identifier" exception. I tried to trap insert/update on Address and on Company, but the City if the first one to get inserted (it's logic...) Any thoughts? Thanks

    Read the article

  • Does remove a DOM object (in Javascript) will cause Memory leak if it has event attached?

    - by seatoskyhk
    So, if in the javascript, I create a DOM object in the HTML page, and attach event listener to the DOM object, upon I remove the the DOM from HTML page, does the event listener still exist and causing memory leak? function myTest() { var obj = document.createElement('div'); obj.addEventListener('click', function() {alert('whatever'); }); var body = document.getElementById('body'); // assume there is a <div id='body'></div> already body.appendChild(obj); } // then after some user actions. I call this: function emptyPage() { var body = document.getElementById('body'); body.innerHTML = ''; //empty it. } So, the DOM object, <div> inside body is gone. But what about the eventlistener? I'm just afraid that it will cause memory leak.

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >