Over in #1667742-19: Add abstracted dialog to core (resolves accessibility bug) the patch at #19 demonstrates that you can use the Request object and Content negotiation from the DIC to do away with nojs in your menu callbacks, ie decide whether the user has js based on the content negotiation.
This is a task to remove this logic from views.
Discussed with tim.plunkett on irc.

Example negotiation

// Check for the content-type.
$container = drupal_container();
$type = FALSE;
if ($container->has('request') && $container->has('content_negotiation')) {
  $type = $container->get('content_negotiation')->getContentType($container->get('request'));
}
if ($type == 'ajax') {
  // ...
}

I did try to sneak a utility wrapper for this into #1737148: Explicitly declare all JS dependencies, don't use drupal_add_js but it was removed until a case could be made for it being re-usable.
Perhaps this is that case?

/**
 * Utility method to get the normalized type of the current request.
 *
 * Fetches the ContentNegotiation and Request objects from the current container
 * and returns the associated request content type. The normalized type is a
 * short, lowercase version of the format, such as 'html', 'json' or 'atom'.
 *
 * @return string
 *   The request type
 */
function drupal_get_request_content_type() {
  $type = &drupal_static(__FUNCTION__);

  if (isset($type)) {
    return $type;
  }
  else {
    $container = drupal_container();
    if ($container->has('request') &&
        $container->has('content_negotiation')) {
      $type = $container->get('content_negotiation')->getContentType($container->get('request'));
    }
    else {
      $type = FALSE;
    }
  }
  return $type;
}
Files: 
CommentFileSizeAuthor
#7 interdiff.txt49.59 KBdawehner
#7 vdc-1831282-7.patch67.71 KBdawehner
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] 66,164 pass(es), 1,003 fail(s), and 41 exception(s). View
#5 vdc-1831282-5.patch18.12 KBdawehner
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] 66,838 pass(es), 243 fail(s), and 2 exception(s). View
#2 drupal-1831282-2.patch41.15 KBdawehner
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] Unable to apply patch drupal-1831282-2.patch. Unable to apply patch. See the log in the details link for more information. View

Comments

tim.plunkett’s picture

Issue tags: +VDC

Tagging.

dawehner’s picture

Component: views.module » ajax system
FileSize
41.15 KB
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] Unable to apply patch drupal-1831282-2.patch. Unable to apply patch. See the log in the details link for more information. View

Finally figured it out that this assumption is build into the ajax system, for example in ajax.js

nod_’s picture

Status: Needs review » Needs work

The last submitted patch, 2: drupal-1831282-2.patch, failed testing.

dawehner’s picture

Status: Needs work » Needs review
FileSize
18.12 KB
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] 66,838 pass(es), 243 fail(s), and 2 exception(s). View

Just a basic reroll for now.

Status: Needs review » Needs work

The last submitted patch, 5: vdc-1831282-5.patch, failed testing.

dawehner’s picture

Status: Needs work » Needs review
FileSize
67.71 KB
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] 66,164 pass(es), 1,003 fail(s), and 41 exception(s). View
49.59 KB

Fixed all of them.

Status: Needs review » Needs work

The last submitted patch, 7: vdc-1831282-7.patch, failed testing.

eric.duran7@gmail.com’s picture

So I was actually about to file an issue about this.

This patches seems like it needs some work and it doesn't look complete.

What's everyone thought on me taking it over? Would it be useful? Personally I'll like to see it happen (not really a fan of the no-js/ajax).

eric.duran7@gmail.com’s picture

This also only seems to be doing Views (I'll be doing it for everything ;-))

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.