Re: [custom-elements-tests] Submission/unipro custom elements (#715)

It was done this way because it incapsulates single chars array and ranges array. Please take a look at BaseChars. In case of BaseChars we'll have to two arrays.

var BaseCharsSingle = [...];
BaseCharsSingle.testEach = testCharCodeArray;

var BaseCharsRanges = [...];
BaseCharsRanges.testEach = testCharCodeRangesArray;

And then have to have two tests for base chars. One test single chars array. The secong tests ranges array. So may be it makes sense to leave things as is, an object that incapsulates data and functions that iterates data? 
If you don't like this approach anyway then I'll create constructor function as you suggested. It'll look like:

function CharsArray(_singleCharsArray, _rangesArray) {
    this.singleCharsArray = _singleCharsArray;
    this.rangesArray = _rangesArray;

    this.testEach = function() {
        if (singleCharsArray != null) {
            // iterate single chars array
        }
        if (rangesArray != null) {
            // iterate ranges array
        }
    }
}

Is this what you entended?

View on GitHub: https://github.com/w3c/web-platform-tests/pull/715#discussion_r10333942

Received on Thursday, 6 March 2014 07:49:53 UTC