diff --git a/2-ui/2-events/04-default-browser-action/1-why-return-false-fails/solution.md b/2-ui/2-events/04-default-browser-action/1-why-return-false-fails/solution.md index 4d175ca01..af47238a5 100644 --- a/2-ui/2-events/04-default-browser-action/1-why-return-false-fails/solution.md +++ b/2-ui/2-events/04-default-browser-action/1-why-return-false-fails/solution.md @@ -1,16 +1,16 @@ -When the browser reads the `on*` attribute like `onclick`, it creates the handler from its content. +Quando o navegador lê o atributo `on*`, como `onclick`, ele cria o manipulador a partir do seu conteúdo. -For `onclick="handler()"` the function will be: +Para `onclick="handler()"` a função será: ```js function(event) { - handler() // the content of onclick + handler() // o conteúdo de onclick } ``` -Now we can see that the value returned by `handler()` is not used and does not affect the result. +Agora podemos ver que o valor retornado por `handler()` não é usado e não afeta o resultado. -The fix is simple: +A correção é simples: ```html run -the browser will go to w3.org +o navegador vai para w3.org ``` -The browser follows the URL on click, but we don't want it. +O navegador segue a URL ao clicar, mas não queremos isso. -How to fix? +Como corrigir? diff --git a/2-ui/2-events/04-default-browser-action/2-catch-link-navigation/solution.md b/2-ui/2-events/04-default-browser-action/2-catch-link-navigation/solution.md index 25079cb8d..a612d1123 100644 --- a/2-ui/2-events/04-default-browser-action/2-catch-link-navigation/solution.md +++ b/2-ui/2-events/04-default-browser-action/2-catch-link-navigation/solution.md @@ -1,5 +1,5 @@ -That's a great use of the event delegation pattern. +Esse é um ótimo uso do padrão de delegação de eventos. -In real life instead of asking we can send a "logging" request to the server that saves the information about where the visitor left. Or we can load the content and show it right in the page (if allowable). +Na vida real, em vez de perguntar, podemos enviar uma requisição de "log" ao servidor que salva a informação sobre por onde o visitante saiu. Ou podemos carregar o conteúdo e mostrá-lo diretamente na página (se permitido). -All we need is to catch the `contents.onclick` and use `confirm` to ask the user. A good idea would be to use `link.getAttribute('href')` instead of `link.href` for the URL. See the solution for details. +Tudo que precisamos é capturar `contents.onclick` e usar `confirm` para perguntar ao usuário. Uma boa ideia seria usar `link.getAttribute('href')` em vez de `link.href` para a URL. Veja a solução para os detalhes. diff --git a/2-ui/2-events/04-default-browser-action/2-catch-link-navigation/solution.view/index.html b/2-ui/2-events/04-default-browser-action/2-catch-link-navigation/solution.view/index.html index 51ac0838b..44dc7e92b 100644 --- a/2-ui/2-events/04-default-browser-action/2-catch-link-navigation/solution.view/index.html +++ b/2-ui/2-events/04-default-browser-action/2-catch-link-navigation/solution.view/index.html @@ -16,7 +16,7 @@
@@ -24,7 +24,7 @@ contents.onclick = function(event) { function handleLink(href) { - let isLeaving = confirm(`Leave for ${href}?`); + let isLeaving = confirm(`Sair para ${href}?`); if (!isLeaving) return false; } @@ -35,6 +35,6 @@ } }; - +