Что такое документ полиглот?

Array.prototype.combs = function(num) {

    var str = this,
        length = str.length,
        of = Math.pow(2, length) - 1,
        out, combinations = [];

    while(of) {

        out = [];

        for(var i = 0, y; i < length; i++) {

            y = (1 << i);

            if(y & of && (y !== of))
                out.push(str[i]);

        }

        if (out.length >= num) {
           combinations.push(out);
        }

        of--;
    }

    return combinations;
}
16
задан Community 23 May 2017 в 12:00
поделиться

3 ответа

Программа-полиглот - это программа, действующая более чем на одном языке. См. http://en.wikipedia.org/wiki/Polyglot_ (вычисления) .

Полиглот (человек) - это тот, кто свободно говорит на многих языках.

Итак, документ полиглота в этом регистр является допустимым как HTML, так и XHTML.

Очевидно, это слово происходит от древнегреческого πολύγλωττος (polugl ,ttos, «многоязычный, многоязычный»), от πολύς (полус, «многие») + γλῶττα (glōtta, «» язык, язык »»)

24
ответ дан 30 November 2019 в 21:03
поделиться

Поли глот происходит от греческого, что означает много языков. Язык в данном случае означает язык. Итак, полиглот - это человек, говорящий на многих языках.

В данном случае полиглот - это документ, который «говорит» на XHTML и HTML. Таким образом, для парсера XHTML он выглядит идеально сформированным, и он также выглядит идеально сформированным для анализатора HTML.

1
ответ дан 30 November 2019 в 21:03
поделиться

See the explanation in the HTML 5 Reference: http://dev.w3.org/html5/html-author/#polyglot-documents

A polyglot HTML document is a document that conforms to both the HTML and XHTML syntactic requirements, and which can be processed as either by browsers, depending on the MIME type used. This works by using a common subset of the syntax that is shared by both HTML and XHTML.

Polyglot documents are useful to create for situations where a document is intended to be served as either HTML or XHTML, depending on the support in particular browsers, or when it is not known at the time of creation, which MIME type the document will ultimately be served as.

In order to successfully create and maintain polyglot documents, authors need to be familiar with both the similarities and differences between the two syntaxes. This includes not only syntactic differences, but also differences in the way stylesheets, and scripts are handled, and the way in which character encodings are detected.

4
ответ дан 30 November 2019 в 21:03
поделиться
Другие вопросы по тегам:

Похожие вопросы: