openoffice-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mar...@apache.org
Subject svn commit: r1528205 - /openoffice/ooo-site/trunk/content/download/test/download_other.js
Date Tue, 01 Oct 2013 20:20:43 GMT
Author: marcus
Date: Tue Oct  1 20:20:43 2013
New Revision: 1528205

URL: http://svn.apache.org/r1528205
Log:
ECMAScript support: Emulate 'indexOf()' function as MSIE 8 and older do not have implemented
this

Modified:
    openoffice/ooo-site/trunk/content/download/test/download_other.js

Modified: openoffice/ooo-site/trunk/content/download/test/download_other.js
URL: http://svn.apache.org/viewvc/openoffice/ooo-site/trunk/content/download/test/download_other.js?rev=1528205&r1=1528204&r2=1528205&view=diff
==============================================================================
--- openoffice/ooo-site/trunk/content/download/test/download_other.js (original)
+++ openoffice/ooo-site/trunk/content/download/test/download_other.js Tue Oct  1 20:20:43
2013
@@ -80,6 +80,24 @@ function write_top() {
  * This writes the header row with the OS headlines
  */
 function write_header( FIRST_HEADER ) {
+	// Add ECMA262-5 Array methods if not supported natively
+	// To workaround that MSIE 8 and older do not support this function
+	if ( !( 'indexOf' in Array.prototype ) ) {
+	  Array.prototype.indexOf= function(find, i /*opt*/) {
+	    if (i === undefined)
+	      i = 0;
+	    if (i < 0)
+	      i+= this.length;
+	    if (i < 0)
+	      i = 0;
+	    for (var n = this.length; i < n; i++) {
+	      if (i in this && this[ i ] === find)
+		return i;
+	    }
+	    return -1;
+	  };
+}
+
 	// If it's the first header at the top of a table use a normal font size
 	// But use a smaller font size for further headers within the table
 	if ( FIRST_HEADER == 1 ) {



Mime
View raw message