Microsoft-authentication-library-for-js: What is the purpose of class attribute on script tag defined in Installation instruction

Created on 29 Aug 2017  路  8Comments  路  Source: AzureAD/microsoft-authentication-library-for-js

Not sure whether this is the right place to post it or not

I noticed in the README.md that a class="pre" is defined on the script tag.

Note that msal.js is built for ES5, therefore enabling support of Internet Explorer 11. If you want to target Internet Explorer, you'll need to add a reference to promises polyfill. You might want to read more in the FAQ

<!-- IE support: add promises polyfill before msal.js  -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/bluebird/3.3.4/bluebird.min.js" class="pre"></script> 
<script src="https://secure.aadcdn.microsoftonline-p.com/lib/0.1.1/js/msal.min.js"></script>

As I am pretty new to HTML5 and JavaScript, I can't understand its purpose (no googling neither stackoverflow gave me a real answer).
Is there any real utility for it? Or is that an internal stuff only for bluebird?

I now this is not really an issue... but I like to understand what I put in my code :)

question

Most helpful comment

The question is what does pre do in this context as shon in the example devapps

<script class="pre">
        var applicationConfig = {
            clientID: 'cd1fdffa-0c1e-4490-a070-812701100306',
            graphEndpoint: "https://graph.microsoft.com/v1.0/me/sendMail",
            graphScopes: ["user.read", "mail.send"],
            b2cScopes: ["https://B2CSriniDev1.onmicrosoft.com/cd1fdffa-0c1e-4490-a070-812701100306/running"],
            authority: "https://login.microsoftonline.com/tfp/B2CSriniDev1.onmicrosoft.com/B2C_1_testsignin"
        };
    </script>

All 8 comments

Hi Guillaume.
MSAL is written in TypeScript, which then generates JavaScript. JavaScript has several standard levels (Ecma Script 5, 6). Unfortunately, Internet Explorer does not support the latest standards, therefore we have chosen to generate from our TypeScript code, the msal.js library compliant to ECMA Script 5. However since our code uses promises (more about that below) to simplify the usage of the library, to be able to us it with IE11, you need to add a reference to the bluebird library which adds support for promises. Promises are a syntax where you can write after a call to an asynchronous method, how you want to process the results (successful or errors). This is the .then() that you see in the code snippet if you want to use your application with JavaScript.
HTH

I realize I have not answered to your question about pre in the script. @rohitnarula7176: would you know?

@ggirard07 @jmprieur The pre tag defines preformatted text. pre element text is displayed in a fixed-width font which preserves both spaces and line breaks. It is just the way the bluebird promise library wanted its content rendered in the browser.

@rohitnarula7176 sorry I am probably too new to HTML and Javascript to properly understand what is going on here.

text is displayed in a fixed-width font which preserves both spaces and line breaks

What is the link between text formatting and loading a script which will not be displayed on the page at the end?

According to https://www.w3schools.com/tags/tag_script.asp, there is no specific usage for the class attribute on a script tag.
Is there any implicit link between the defined attribute class="pre" on the script tag I mentioned and the pre tag you are referring to?

Sorry if this is an irrelevant question as it should work as is. I am just trying to understand what I am coding :)

The question is what does pre do in this context as shon in the example devapps

<script class="pre">
        var applicationConfig = {
            clientID: 'cd1fdffa-0c1e-4490-a070-812701100306',
            graphEndpoint: "https://graph.microsoft.com/v1.0/me/sendMail",
            graphScopes: ["user.read", "mail.send"],
            b2cScopes: ["https://B2CSriniDev1.onmicrosoft.com/cd1fdffa-0c1e-4490-a070-812701100306/running"],
            authority: "https://login.microsoftonline.com/tfp/B2CSriniDev1.onmicrosoft.com/B2C_1_testsignin"
        };
    </script>

@ggirard07 @jmprieur The pre tag defines preformatted text. pre element text is displayed in a fixed-width font which preserves both spaces and line breaks. It is just the way the bluebird promise library wanted its content rendered in the browser.

You clearly didn't read the question, but chose to answer and close it anyway. The question wasn't about <pre /> its about a <script class="pre" />, and what function, if any, the pre class has on the script.

This ticket needs to be re-opened until its _actually_ answered

@navyasric

I would also love to know the answer :)

Was this page helpful?
0 / 5 - 0 ratings