diff --git a/src/extensions/default/WebPlatformDocs/main.js b/src/extensions/default/WebPlatformDocs/main.js
index <HASH>..<HASH> 100644
--- a/src/extensions/default/WebPlatformDocs/main.js
+++ b/src/extensions/default/WebPlatformDocs/main.js
@@ -84,9 +84,9 @@ define(function (require, exports, module) {
      * @return {?$.Promise} resolved with an InlineWidget; null if we're not going to provide anything
      */
     function inlineProvider(hostEditor, pos) {
+        var langId = hostEditor.getLanguageForSelection().getId();
         // Only provide docs when cursor is in CSS content
-        if (hostEditor.getLanguageForSelection().getId() !== "css" &&
-                hostEditor.getLanguageForSelection().getId() !== "scss") {
+        if (langId !== "css" && langId !== "scss") {
             return null;
         }
Use a variable to store the language ID so that we don't have to call the same functions multiple times when checking it.