OL-20899 - Реализовать единый перехватчик Click событий на документе

Get Started. It's Free
or sign up with your email address
Rocket clouds
OL-20899 - Реализовать единый перехватчик Click событий на документе by Mind Map: OL-20899 - Реализовать единый перехватчик  Click событий на документе

1. LinkHook

1.1. each link handled by its listener

1.2. Link actication

1.2.1. UIHelper.sinkEvents(elem, Event.ONCLICK);

1.2.2. if link to state, change it on a desktop

1.2.3. else - navigate to link

1.3. extends AHook

2. Aim

2.1. Unified (and only one) link handler

2.2. By element source delegate event handling

2.3. Use tagName "a"

2.4. Send handling to LinkHook logic

2.5. To remove hundreds of click handlers for links

2.6. Now work only with link click handlers

2.7. Remove instantiation of LinkHook in HookAdapter

3. See event.stopPropagation usage

3.1. prevents handling by parent handlers

3.2. Used in ~ 100 places

4. See where are click listeners

4.1. ClickEventListener

4.1.1. 105 impls

4.2. another click listener classes?

4.3. Click handlers in DiscussionsEventProcessor?

4.4. gwt.ClientHandler implementors

4.4.1. 120 impls

4.5. gwt.ClickListener implementors

4.5.1. 36 impls

5. HookAdapter

5.1. LinkHook implementations

5.1.1. StateLink

5.1.2. ShortLink

6. Impl notes

6.1. On module start add clickhandler to document

6.1.1. which module? hook or block?

6.2. Click handler checks link and sends it to linkhook ot a given implementation from it

6.3. Calls preventDefault

6.4. Don't use stopPropagation because we are on the upper level (no parents to handle)

6.5. Disable linkhook when handler is ready

6.5.1. If not to do that model will apply LinkHook to links

6.6. Possible difficulties

6.6.1. Uncorrect 'target' detection

7. TODO

7.1. See LinkHook activation chain (methods which call it)

7.2. Why everything crashed if you disable link capturin in HookAdapter?

7.3. Is it needed to remove link hook capturing from HookAdapter?

7.3.1. How not to get bugs from mail.ru banners etc

7.4. Why such snippets dont work?

7.4.1. document.addEventListener('click', function(event) { alert("This link tries to redirect you to " + event.target); event.preventDefault(); }, true);

8. Mechanism

8.1. click

8.1.1. check whether link is usual or short (from HookAdapter)

8.1.2. link hook activation logic

8.1.3. short link activation logic (if so)

8.1.4. LinkHook click logic

8.1.4.1. override getHref for short links