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

Lancez-Vous. C'est gratuit
ou s'inscrire avec votre adresse e-mail
OL-20899 - Реализовать единый перехватчик Click событий на документе par Mind Map: OL-20899 - Реализовать единый перехватчик  Click событий на документе

1. See where are click listeners

1.1. ClickEventListener

1.1.1. 105 impls

1.2. another click listener classes?

1.3. Click handlers in DiscussionsEventProcessor?

1.4. gwt.ClientHandler implementors

1.4.1. 120 impls

1.5. gwt.ClickListener implementors

1.5.1. 36 impls

2. HookAdapter

2.1. LinkHook implementations

2.1.1. StateLink

2.1.2. ShortLink

3. Impl notes

3.1. On module start add clickhandler to document

3.1.1. which module? hook or block?

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

3.3. Calls preventDefault

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

3.5. Disable linkhook when handler is ready

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

3.6. Possible difficulties

3.6.1. Uncorrect 'target' detection

4. LinkHook

4.1. each link handled by its listener

4.2. Link actication

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

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

4.2.3. else - navigate to link

4.3. extends AHook

5. Aim

5.1. Unified (and only one) link handler

5.2. By element source delegate event handling

5.3. Use tagName "a"

5.4. Send handling to LinkHook logic

5.5. To remove hundreds of click handlers for links

5.6. Now work only with link click handlers

5.7. Remove instantiation of LinkHook in HookAdapter

6. See event.stopPropagation usage

6.1. prevents handling by parent handlers

6.2. Used in ~ 100 places

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