Поиск в Поддержке

Избегайте мошенников, выдающих себя за службу поддержки. Мы никогда не попросим вас позвонить, отправить текстовое сообщение или поделиться личной информацией. Сообщайте о подозрительной активности, используя функцию «Пожаловаться».

Подробнее

When I click on a link after an onblur event throws an alert div on the screen, the href value of the link is pasted to any textbox my mouse cursor is over.

more options

Noticed in FF 15 and 16 - when a page contains a textbox or textarea with an onblur event that fires an alert(), and the user invokes the onblur event by clicking on a link, then the HREF value of that link will be posted as plain text into whatever textbox or textarea the user has his mouse cursor over when the alert is cleared (either by hitting return or clicking OK).

Note - If the user decides to use a keypress - return or space - to hit the OK button on the alert, the alert will not clear and the text will not paste into the textarea or textbox until the mouse cursor is moved again.

I will include the HTML of a test page.

1) Click within the textarea. 2) Click on a link outside of the textarea. 3) Position your mouse cursor over the textarea, then hit return to clear the alert that pops up. 4) Move your mouse slightly and the HREF value of the link should paste into the textarea. The link does not actually work (the one in this example should also fire an alert) if clicked in this way.


The HTML of the test page: http://pastebin.com/mb0BsCGh

Noticed in FF 15 and 16 - when a page contains a textbox or textarea with an onblur event that fires an alert(), and the user invokes the onblur event by clicking on a link, then the HREF value of that link will be posted as plain text into whatever textbox or textarea the user has his mouse cursor over when the alert is cleared (either by hitting return or clicking OK). Note - If the user decides to use a keypress - return or space - to hit the OK button on the alert, the alert will not clear and the text will not paste into the textarea or textbox until the mouse cursor is moved again. I will include the HTML of a test page. 1) Click within the textarea. 2) Click on a link outside of the textarea. 3) Position your mouse cursor over the textarea, then hit return to clear the alert that pops up. 4) Move your mouse slightly and the HREF value of the link should paste into the textarea. The link does not actually work (the one in this example should also fire an alert) if clicked in this way. The HTML of the test page: http://pastebin.com/mb0BsCGh

Изменено coxdaniel88

Все ответы (3)

more options

It's a bit messy pasting HTML code here on the forum, and I think something got lost there. Can you use Pastebin or another site of your choice?

more options

Whoops, I didn't even notice that. Let me go grab a pastebin link, sorry about that.

http://pastebin.com/mb0BsCGh

more options

Here are my test results.

(1) Click the textarea, click the link, move the mouse away from the link to a blank area of the page, press Enter. There is no second alert, nothing is pasted to the textarea. These events are fired:

  • click on the textarea, then mousemove and mouseout
  • mouseover, mousemove, and mousedown on the link
  • mouseout on the link -- alert displays and I move the mouse pointer away from the controls then press Enter
  • blur
  • focus
  • draggesture
  • keyup (keyCode = 13)

(2) Click the textarea, click the link, move the mouse back over the textarea, press Enter. There is no second alert, the href of the link is pasted to the textarea. These events are fired:

  • click on the textarea, then mousemove and mouseout
  • mouseover, mousemove, and mousedown on the link
  • mouseout on the link -- alert displays and I move the mouse pointer over the textarea then press Enter
  • blur
  • focus
  • draggesture
  • dragenter
  • input
  • mouseover on the textarea
  • keyup (keyCode = 13)

So Firefox is starting a drag operation when the link is clicked and the alert is displayed and dismissed. Dragging a link to a textarea pastes its href, so that's why you see that. But why is Firefox performing a drag operation under these circumstances?