Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

<script /> 资源执行错误,仍执行 onLoad 事件 #419

Open
maoxiaoke opened this issue Oct 12, 2021 · 0 comments
Open

<script /> 资源执行错误,仍执行 onLoad 事件 #419

maoxiaoke opened this issue Oct 12, 2021 · 0 comments
Labels
enhancement New feature or request

Comments

@maoxiaoke
Copy link
Collaborator

非 icestark 错误,需要考虑下是否要处理这种情况

image

Demo: index.html

<!DOCTYPE html>
<html>
  <body>
    <script>
      const element = document.createElement('script');

      element.src = './index.js'

      element.addEventListener(
      'error',
      () => {
        console.log('error----')
      },
      false,
    );
    element.addEventListener('load', () => {
      console.log('load---')
    }, false);

    document.getElementsByTagName('head')[0].appendChild(element)

    </script>
  </body>
</html>

index.js

(function(){
  throw new Error('error')
})();
@maoxiaoke maoxiaoke added the enhancement New feature or request label Jan 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant