• Robert Knight's avatar
    Remove `metadata` field from `HTMLMetadata` · a5c112a0
    Robert Knight authored
    The `HTMLMetadata` class provided two ways to get at the document
    metadata:
    
     1. A `getDocumentMetadata` method which reads the current metadata from
        the document and returns it
     2. A `metadata` field which returns the last-read metadata
    
    The `metadata` field was not used outside the tests and shouldn't be used
    because it might return stale metadata (in a web page with client-side
    JS that updates `<meta>` and `<link>` tags etc. after the page loads). This field
    was also used internally by the various helper methods that gather metadata,
    with non-obvious constraints on the order in which the helpers are called.
    
    Remove the field to prevent external mis-use of the class and make the data flow
    and dependencies clearer internally.
    a5c112a0
html-metadata-test.js 11.8 KB