[Webkit-unassigned] [Bug 167091] New: JavaScript for-of on HTML Collection in Safari

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Jan 16 08:05:08 PST 2017


https://bugs.webkit.org/show_bug.cgi?id=167091

            Bug ID: 167091
           Summary: JavaScript for-of on HTML Collection in Safari
    Classification: Unclassified
           Product: WebKit
           Version: Safari 10
          Hardware: Macintosh
                OS: macOS 10.12
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: WebKit API
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: email.james.macdonald at gmail.com

Consider the following code:

<html>
    <head>
        <meta charset="utf-8">
    </head>
    <body>
        <div class="cell">div 1 text</div>
        <div class="cell">div 2 text</div>
        <div class="cell">div 3 text</div>
        <script type="text/javascript">
            let list = document.getElementsByClassName("cell")
                for(let y of list){
                    console.log("y:", y)
                }
        </script>  
    </body>
</html>

When run in Chrome V55.0, it produces the following console output:

y:        <div class="cell">div 1 text</div>
y:        <div class="cell">div 2 text</div>
y:        <div class="cell">div 3 text</div>
Firefox V50.1 returns similar results as well.

However when run in Safari, this same file generates an error stating

TypeError: y of list is not a function. (In 'y of list', 'y of list' is >undefined).

This appears to be because the value returned to the list variable is not an array, but an HTML collection as described in the following link:

https://bugs.chromium.org/p/chromium/issues/detail?id=538558

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-unassigned/attachments/20170116/f75dcaf7/attachment.html>


More information about the webkit-unassigned mailing list