app/assets/javascripts/local_time.js.coffee in local_time-0.1.0 vs app/assets/javascripts/local_time.js.coffee in local_time-0.2.0

- old
+ new

@@ -169,19 +169,20 @@ for element in document.querySelectorAll selector callback element document.addEventListener "DOMContentLoaded", -> domLoaded = true + textProperty = if "textContent" of document.body then "textContent" else "innerText" process "time[data-local]:not([data-localized])", (element) -> datetime = element.getAttribute "datetime" format = element.getAttribute "data-format" local = element.getAttribute "data-local" time = new Date Date.parse datetime return if isNaN time - element.innerText = + element[textProperty] = switch local when "time" element.setAttribute "data-localized", true strftime time, format when "time-ago"