Menu

#927 support for document.lastModified

closed
None
5
2012-10-21
2009-10-09
Marco Cova
No

The property lastModified of the document object (https://developer.mozilla.org/en/DOM/document.lastModified) appears not to be supported by htmlunit.

The files in attachment add a test case and a patch to add support for document.lastModified
(the diffs are against a (very) old version of htmlunit, sorry, but it should be easy to adapt them to the current version)

Discussion

  • Marco Cova

    Marco Cova - 2009-10-09

    test case for document.lastModified

     
  • Marco Cova

    Marco Cova - 2009-10-09

    patch to add support for document.lastModified

     
  • Marc Guillemot

    Marc Guillemot - 2009-10-16

    Now fixed in SVN.

    I see that you attached patches now that I've fixed it :-(

    I don't agree on your test case: the problem is that the date string returned depends from the current time zone and therefore you have to take it into account to have a test that runs everywhere.
    I've taken the Date header into account as well.
    In Firefox 3 (at least), document.lastModified doesn't return an empty string if no date header is present: it returns the current time.

    Please reopen with a test case if you don't agree with my implementation.

     
  • Richard Eggert

    Richard Eggert - 2009-12-23

    The format of the date provided in Marco's test case was correct, though I agree that he did neglected to take the time zone into account. Your implementation is incorrect as it generates the date string in the wrong format, as I've detailed in bug #2919853. My test case should resolve the timezone issue, as I didn't bother to validate the actual date and time returned; I just validate the format, since I couldn't think of a good way to check the specific date and time without actually implementing the lastModified property in my unit test.

     

Log in to post a comment.