Speed up broken image selector
Using jquery this took 5ms just on the login page: https://cl.ly/0ffa8030060d using document.querySelectorAll will be faster Test plan: * the broken image fallbacks should work exactly the same as before Change-Id: I1c38974dbcc55d5f777d48a7603ce847217b0ec6 Reviewed-on: https://gerrit.instructure.com/208615 Tested-by: Jenkins Reviewed-by: Clay Diffrient <cdiffrient@instructure.com> QA-Review: Ryan Shaw <ryan@instructure.com> Product-Review: Ryan Shaw <ryan@instructure.com>
This commit is contained in:
parent
f3194958b4
commit
88b3e9ab47
|
@ -44,9 +44,7 @@ export function attachErrorHandler(imgElement) {
|
|||
}
|
||||
|
||||
export function getImagesAndAttach () {
|
||||
$('img[src!=""]')
|
||||
.toArray()
|
||||
.forEach(attachErrorHandler)
|
||||
Array.from(document.querySelectorAll('img:not([src=""])')).forEach(attachErrorHandler)
|
||||
}
|
||||
|
||||
// this behavior will set up all broken images on the page with an error handler that
|
||||
|
|
Loading…
Reference in New Issue