material icon indicating copy to clipboard operation
material copied to clipboard

Are there documented functions of `md-list`?

Open dmitriz opened this issue 11 years ago • 5 comments

What exactly are the functions of md-list?

  • The documentation of md-list is impressively terse.
  • The demo example does not seem to change at all when removing md-list (http://codepen.io/dmitriz/pen/rVMVLm?editors=101)
  • Yet the tests show quite a few things going behind the curtain: https://github.com/angular/material/blob/master/src/components/list/list.spec.js with not a single comment explaining the intention.

Is this mystery uncovered somewhere or any plans to?

dmitriz avatar May 20 '15 13:05 dmitriz

The tests you linked are for mdListItem. Most of md-list-item's functionality is providing styling (ie. syntax to make things look like standard material list items) and accessibility (eg. automatically delegating click events to the appropriate child target if an ng-click is on a parent md-list-item.

The code for the md-list is as follows:

function mdListDirective($mdTheming) {
  return {
    restrict: 'E',
    compile: function(tEl) {
      tEl[0].setAttribute('role', 'list');
      return $mdTheming;
    }
  };
}

So, it implements theming, and that's about it.

rschmukler avatar May 20 '15 14:05 rschmukler

Many thanks, I see, the file is called list but the tests are for the list-item, sorry for the confusion :)

Any reason to use .querySelector('div') with div here (rather than another tag): https://github.com/angular/material/blob/master/src/components/list/list.spec.js#L15

About md-list implementing theming - is there any explanation how this works? Is the theming working differently inside and outside the directive?

dmitriz avatar May 20 '15 15:05 dmitriz

The query selector is in response to how the directive compiles itself. Specifically, it will, in that case, create a wrapper div. So we are just grabbing it.

As for the theming stuff, check out the docs on theming which explains how theming could be used. Basically that line of code enables the component to alternate themes (for example one where your foreground palette used white text and a dark background). Check out the section on multiple themes for more information.

rschmukler avatar May 20 '15 19:05 rschmukler

So am I right in understanding that any click on <md-list-item> is forwarded to all enclosed <md-checkbox> elements simultaneously? Even if I have several checkboxes, every one will be clicked?

About themes, am I right that <md-list> applies the default theme to anything inside it? But then wouldn't <md-checkbox> or any other md- directive get the same default theme even without it?

This will apply a custom theme to anything inside:

  <div md-theme="altTheme">...</div>

But then again, wouldn't the same theme apply regardless of the md-list directive hanging around?

Sorry for the confusion. Maybe it would be made clear by example, where md-list directive would change the behavior?

dmitriz avatar May 21 '15 10:05 dmitriz

This message was created automatically by mail delivery software.

A message that you sent could not be delivered to one or more of its recipients. This is a temporary error. The following address(es) deferred:

[email protected] Domain zyapps.com has exceeded the max emails per hour (421/400 (105%)) allowed. Message will be reattempted later

------- This is a copy of the message, including all the headers. ------ Received: from o5.sgmail.github.com ([192.254.113.10]:54726) by serveur.ex2-p10.com with esmtps (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.87) (envelope-from [email protected]) id 1avsZl-001Z7Q-Iu for [email protected]; Thu, 28 Apr 2016 22:30:18 +0200 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=github.com; h=from:reply-to:to:cc:in-reply-to:references:subject:mime-version:content-type:content-transfer-encoding:list-id:list-archive:list-post:list-unsubscribe; s=s20150108; bh=Qbj6b4H2H990O81wAbLom9Z+ok4=; b=MjpS+BACdO5XUGRl M3rKT0mIUYulaYuZeSxa7pTo20AHzo5Jf2mQoE8G7/PD8rBgzun5892Uj/ZAXYDn 4IYTRlK2kcdI8fALaQbZhd0/T9Y7za3cE1utJ2tov+Otx8Gx/KtgkQSLzgnRjqa+ 3fhSKye1doVfTRyCKKVhV9Ov2xI= Received: by filter0690p1mdw1.sendgrid.net with SMTP id filter0690p1mdw1.16926.572272AC3E 2016-04-28 20:29:32.790214616 +0000 UTC Received: from github-smtp2a-ext-cp1-prd.iad.github.net (github-smtp2a-ext-cp1-prd.iad.github.net [192.30.253.16]) by ismtpd0001p1iad1.sendgrid.net (SG) with ESMTP id wrf9p1foQRGbe4vQ2RO71w for [email protected]; Thu, 28 Apr 2016 20:29:32.764 +0000 (UTC) Date: Thu, 28 Apr 2016 13:29:32 -0700 From: Thomas Burleson [email protected] Reply-To: angular/material [email protected] To: angular/material [email protected] Cc: Message-ID: angular/material/issue/2925/issue_event/[email protected] In-Reply-To: angular/material/issues/[email protected] References: angular/material/issues/[email protected] Subject: Re: [angular/material] Are there documented functions of md-list? (#2925) Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="--==_mimepart_572272ac943c2_1f2c3ff2d9fcb2bc18438b"; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: list X-GitHub-Sender: ThomasBurleson X-GitHub-Recipient: yanndupuy List-ID: angular/material <material.angular.github.com> List-Archive: https://github.com/angular/material List-Post: mailto:[email protected] List-Unsubscribe: mailto:unsub+000df0dc731d2dd0679ce8ff11d9afe8758951d1daaa66e492cf00000001133a34ac92a169ce04ae121b@reply.github.com, https://github.com/notifications/unsubscribe/AA3w3L4FWS74SDlvhkLbqEkkPUwAbTjNks5p8RisgaJpZM4EhzJr X-Auto-Response-Suppress: All X-GitHub-Recipient-Address: [email protected] X-SG-EID: /bDRkhSo/GH2gzZXMo5AKhbuTgLDPkexBjh/BYa140Eiw51df5bmD4kgETKicCBC2N+Il6RewiBexI giv11NSFFH9sc7ID+Ktcbb9TZ/LTrnh2/7A8Jf6pTUpGZe01WScGEu3r3O9ihCxmR9CFmb1HK97F// 6zP/tL2YCWXa/vjneRDwEOLPD0JocvTRNtHfpF548eda0C3P44YglkQU1Y5mAQlxdvC6HYYMETWnhg E= X-Spam-Status: No, score=0.5 X-Spam-Score: 5 X-Spam-Bar: / X-Ham-Report: Spam detection software, running on the system "serveur.ex2-p10.com", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see root@localhost for details.

Content preview: Closed #2925. --- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/angular/material/issues/2925#event-644848390 Closed #2925. [...]

Content analysis details: (0.5 points, 5.0 required)

pts rule name description


-1.0 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain 1.6 HTML_IMAGE_ONLY_12 BODY: HTML: images with 800-1200 bytes of words 0.0 HTML_MESSAGE BODY: HTML included in message 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain X-Spam-Flag: NO

----==_mimepart_572272ac943c2_1f2c3ff2d9fcb2bc18438b Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit

Closed #2925.


You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/angular/material/issues/2925#event-644848390 ----==_mimepart_572272ac943c2_1f2c3ff2d9fcb2bc18438b Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit

Closed #2925.

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub

----==_mimepart_572272ac943c2_1f2c3ff2d9fcb2bc18438b--

yanndupuy avatar Apr 28 '16 20:04 yanndupuy